I knew that they introduced a formatting library in C++20, which first and foremost has a "format" function that does away with the old iomanip stuff and the << operator all over the place, but I hadn't really looked into it until recently.

And I'm in love. I use format all the time now. Why did I not look into this sooner?

I don't think I really realized how much of a hassle it was to use the old << way of writing to output streams. There are still times when that is useful, but for detailed formatting of text, it really REALLY sucked!

#C++ #cplusplus #cplusplus20 #programming

@morten it's really silly how we depended on an unlocked global object thing to eventually send data to be written to stdout. You really shouldn't have to worry about things such as a "polluted" state for cout, which would ask that you flush before and after to avoid potential silliness.

Streams as a concept independent from C++ are good, but not the way C++ does them

@cristei I agree with you completely! Unfortunately I'm still on GCC 13, that does include the format library, but not yet the newer print library, which came in C++23.

So I'm still stuck with cout and cin for a while longer 😅