<spanstream> will debut in C++23 (see cppreference). According to the proposal, they are string-streams with std::span based buffers.
My questions are:
std::spanstream have somewhat equivalent uses of the old std::strstream (or strstream deprecated in C++ 98)?They are intended to be a near drop-in replacement for strstream (except with proper bounds checking). As such, they will have the exact same use cases. When you have an existing buffer that you want to stream into/outof.
The ability to move a std::string into stringstreams added in C++20 eliminated the use case when the existing buffer is in a std::string. But sometimes you just have a naked char const* with a known length.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With