25 int size = std::vsnprintf(
26 const_cast<char*>(out.data()), out.size() + 1, fmt, args);
28 if (size >= static_cast<int>(out.size())) {
31 size = std::vsnprintf(
32 const_cast<char*>(out.data()), out.size() + 1, fmt, args);
42 std::string
ssnprintf(
size_t max_size,
const char* fmt, ...) {
49 int size = std::vsnprintf(
50 const_cast<char*>(out.data()), out.size() + 1, fmt, args);
52 if (static_cast<size_t>(size) < max_size)
53 out.resize(static_cast<size_t>(size));
std::string ssprintf(const char *fmt,...)
Helper for return the result of a sprintf() call inside a std::string.
std::string ssnprintf(size_t max_size, const char *fmt,...)
Helper for return the result of a snprintf() call inside a std::string.