11 #ifndef TLX_STRING_SSPRINTF_GENERIC_HEADER 12 #define TLX_STRING_SSPRINTF_GENERIC_HEADER 30 template <
typename String = std::
string>
34 template <typename String>
42 int size = std::vsnprintf(
43 const_cast<char*>(out.data()), out.size() + 1, fmt, args);
45 if (size >= static_cast<int>(out.size())) {
48 size = std::vsnprintf(
49 const_cast<char*>(out.data()), out.size() + 1, fmt, args);
65 template <
typename String = std::
string>
69 template <
typename String>
77 int size = std::vsnprintf(
78 const_cast<char*>(out.data()), out.size() + 1, fmt, args);
80 if (static_cast<size_t>(size) < max_size)
81 out.resize(static_cast<size_t>(size));
92 #endif // !TLX_STRING_SSPRINTF_GENERIC_HEADER String ssprintf_generic(const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(1
Helper for return the result of a sprintf() call inside a string object.
#define TLX_ATTRIBUTE_FORMAT_PRINTF(X, Y)
String ssnprintf_generic(size_t max_size, const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(2
Helper for return the result of a snprintf() call inside a string object.