4 ms·
>Fortunately there is an incoming way out of that with work of Viktor Zverovich on std::format and libfmt Those are great, but iostreams hasn't been necessary
by shiroiuma 3y ago
>Fortunately there is an incoming way out of that with work of Viktor Zverovich on std::format and libfmt
Those are great, but iostreams hasn't been necessary in a very long time thanks to other libraries like Qt and Boost.
- adev_ 3y agoYes. Several alternatives have been available for a while. The success of Victor has been to make the C++ committee accepts the idea that a new formatter was necessary and to bring <format> in the STL. This was not a small task: The committee has its fair amount of dinosaur gatekeepers and windmills [1]. For the best and the worst. We at least now have a way forward to evolve from <iostream> if we want to with maybe one day the hope of getting something that can entirely replace iostream. [1]: Windmills: Person displacing air around but not much more than air.
- GuB-42 3y agoIt is a problem of gatekeeping or just that std::format is actually rather complicated under the hood. For all their flaws, iostreams have the advantage of being simple to implement. They are just overloads of the << and >> operators. std::format and likes require a lot of meta-programming magic to work correctly. It means longer compile times, less tolerance for broken compilers, and possibly weird edge cases, which are important considerations when designing a standard that will be used everywhere. And when it's there, it is there for good, so I understand the committee for being careful. From ANSI C++ to C++20, a lot of work has been done making meta-programming more sensible, and computers became more powerful, which makes it ready for something like std::format.
- GuB-42 3y agoAvoiding dependencies is a good thing, especially for C++, that doesn't have a widely used centralized repository and dependency manager like npm, cargo or cpan. For the better or for the worse. And pulling Boost, let alone Qt just to avoid the occasional use of iostreams (or printf) is a bit much IMHO. I usually try to avoid Boost, as I feel it is more of a sort of beta/preview for the standard library. Don't get me wrong, it is production-worthy, but it can lead to awkward things when some boost feature ends up in the standard libraries and the project ends up with bits of both. std::format is great because at last, we can use it without dependencies.