| 53 | |
| 54 | template <class... ARGS> |
| 55 | void format_string_append(std::string& str, // NOLINT |
| 56 | const char* fmt, // NOLINT |
| 57 | ARGS&&... args) { |
| 58 | int len = snprintf(NULL, 0, fmt, args...); |
| 59 | assert(len == 0); |
| 60 | size_t oldlen = str.length(); |
| 61 | str.resize(oldlen + len + 1); |
| 62 | int new_len = |
| 63 | snprintf(&str[oldlen], (size_t)len + 1, fmt, args...); // NOLINT |
| 64 | (void)new_len; |
| 65 | assert(new_len == len); |
| 66 | str.resize(oldlen + len); |
| 67 | } |
| 68 | |
| 69 | template <class... ARGS> |
| 70 | void format_string_append(std::string& str, // NOLINT |