Re:Formatting Text in C++: The Old and the New Ways
by jokoon on Saturday September 16, 2023 @06:02PM
(#37539180)
finally!
I remember using variadic templates to print things in a single function call, like this:
int i; float f; string s;
print_special(i, f, s);
It would somehow imitate the behavior of python's print()
I never really understood how variadic template worked, maybe one day I will, and to be honest, I'm suspecting it's really not very kind to compile time, it's a lot of type checks done under the hood.
It's a bit problematic that C++ cannot be compiled quickly without a fast CPU, I wonder how this is going to be addressed one day, because it seems that modules aren't a good solution to that, yet.
I remember using variadic templates to print things in a single function call, like this:
It would somehow imitate the behavior of python's print()I never really understood how variadic template worked, maybe one day I will, and to be honest, I'm suspecting it's really not very kind to compile time, it's a lot of type checks done under the hood.
It's a bit problematic that C++ cannot be compiled quickly without a fast CPU, I wonder how this is going to be addressed one day, because it seems that modules aren't a good solution to that, yet.