Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Remember that C++ originally didn't have variadic templates, so something like std::format would have been impossible back in the day. Back in the day, std::iostream was a very neat solution for type safe string formatting. As you conceded, it also makes it very easy to integrate your own types. It was a big improvement over printf(). Historic perspective is everything.


{fmt} used to support pre-C++11 compilers that didn't have variadic templates. It was a pain to emulate variadics but it wasn't impossible.


Wow, I don't know that! I would be curious to know how they did it.


It was emulated using horrible macros: https://github.com/fmtlib/fmt/blob/8f5e07656e25ec64ec7c843f0.... IIRC some early versions of `std::tuple` did something similar.


Oh, I didn't realize you're the author! Thank you so much for fmt/std::format - it's truely a godsend!


Glad you like it =)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: