mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-10-12 02:13:06 +00:00
1. Use `fmt::format_int` directly instead of parsing a format string. 2. Use `AppendStrView`. 3. Define the varargs versions using fold expressions when available. 4. Add tests.
21 lines
439 B
C++
21 lines
439 B
C++
#include "utils/str_cat.hpp"
|
|
|
|
#include <fmt/format.h>
|
|
|
|
namespace devilution {
|
|
|
|
char *BufCopy(char *out, int value)
|
|
{
|
|
const fmt::format_int formatted { value };
|
|
std::memcpy(out, formatted.data(), formatted.size());
|
|
return out + formatted.size();
|
|
}
|
|
|
|
void StrAppend(std::string &out, int value)
|
|
{
|
|
const fmt::format_int formatted { value };
|
|
out.append(formatted.data(), formatted.size());
|
|
}
|
|
|
|
} // namespace devilution
|