| 74 | |
| 75 | template<size_t N, typename... Args> |
| 76 | std::string string_format( const char (&format)[N], const Args&... args ) |
| 77 | { |
| 78 | int size_s = std::snprintf( nullptr, 0, format, args... ); |
| 79 | if( size_s <= 0 ) |
| 80 | { |
| 81 | return ""; |
| 82 | } |
| 83 | auto size = static_cast<size_t>( size_s + 1 ); |
| 84 | std::string buf( size, 0 ); |
| 85 | std::snprintf( buf.data(), size, format, args... ); |
| 86 | return buf; |
| 87 | } |
| 88 | |
| 89 | const char* string_format( const char* txt ) |
| 90 | { |