Consider the following declarations:
std::ostringstream oss;
std::string str;
char buffer[100];
int intvalue = 42;
float floatvalue = 3.14;
std::to_chars_result r;
To convert the intvalue integer to a string of digits, C++17 offers us the following options:
snprintf(buffer, sizeof buffer, "%d", intvalue);
// available in <stdio.h>
// locale-independent (%d is unaffected by locales)
// non-allocating
// bases 8, 10, 16 only
oss << intvalue;
str = oss.str();
// available in <sstream>
// locale-problematic (thousands separator may be inserted)
// allocating; allocator-aware
// bases 8, 10, 16 only
str = std::to_string(intvalue);
// available since C++11 in <string>
// locale-independent (equivalent to %d)
// allocating; NOT allocator...