SmallString: Add vformat overloads

This commit is contained in:
Stenzek
2024-04-11 13:42:00 +10:00
parent 1809885927
commit f75a5605eb
3 changed files with 46 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "small_string.h"
@ -439,6 +439,12 @@ void SmallStringBase::assign(const std::string_view str)
append(str.data(), static_cast<u32>(str.size()));
}
void SmallStringBase::vformat(fmt::string_view fmt, fmt::format_args args)
{
clear();
fmt::vformat_to(std::back_inserter(*this), fmt, args);
}
bool SmallStringBase::equals(const char* str) const
{
if (m_length == 0)