tinyformat

tinyformat is my choice when it comes to replace the printf-family functions from c. In business quite for some time (initial release around 2011?), tinyformat became a mature working-horse, providing basic compatibility with c99 printf.

Not overly much surprizing, tinyformat uses a ostringstream under the hood, and relies on std::ostream operator<<(std::ostream &, const T &) signatures to assemble the output.

It works with older compilers as well, but has some slight optimizations when compiled in c++11 mode. Since usage is equal to c99, non-surpizingly everything works as expected:

std::string out = tfm::format("%s bar is around %.2f", "foo", 42.123);
// produces: out = "foo bar is around 42.12"
 
out = tfm::format("%s", 42.0123f);
// produces: out = "42.0123", without failing / throwing
 
out = tfm::format("%s %s", "just one arg")
// however throws because of just one value, but two specifiers

What I really like about tinyformat

What I don’t like:

Roman’s Rating: 4.6 / 5.0

Information