5#ifndef FORESTHUB_UTIL_STRPRINTF_HPP
6#define FORESTHUB_UTIL_STRPRINTF_HPP
30#if defined(__GNUC__) || defined(__clang__)
33inline std::string
StrPrintf(
const char* fmt, ...) __attribute__((format(printf, 1, 2)));
35inline std::string
StrPrintf(
const char* fmt, ...);
41 va_copy(args2, args1);
43 int len = vsnprintf(
nullptr, 0, fmt, args1);
51 std::string result(
static_cast<size_t>(len),
'\0');
52 vsnprintf(&result[0],
static_cast<size_t>(len) + 1, fmt, args2);
Utility types: Optional polyfill, JSON Schema normalization, Ticker.
std::string StrPrintf(const char *fmt,...)
Builds a std::string using printf-style formatting.
Definition strprintf.hpp:38
Top-level namespace for the ForestHub SDK.