Context: I work on legacy code, and while I want to slowly make this code up to c++14 standard, I'm still stuck with function likes printf.
Hence this kind of code:
template <typename... Args>
const char* Format(const char* strFormat, Args... args)
static char szBuffer;
auto len = std::vsnprintf(szBuffer, 10000, strFormat, args...);
if (len < 0 || 10000 <= len)
szBuffer = 0;
auto test = Format("%s %s %d", "test", "test", 42);
10:66: error: cannot convert 'const char*' to '__va_list_tag*' for argument '4' to 'int vsnprintf(char*, size_t, const char*, __va_list_tag*)'
vsnprintf. Parameter packs expand into comma-separated lists. The
v version of these functions only accept a
In looking at your code examples, you're still going to need a function like
transform_to_c if you intend to pass a
Side note: You should consider whether this code needs to be thread-safe or reentrant. Using a static buffer means it is neither.