<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 stringstream
s 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.