I was hoping stringstream has a constructor that steals its initial content from a string&&. Do such inter-species \"move constructors\" genera
Why doesn't
std::stringstream::stringstream(std::string&&)exist?
This is due to std::stringstream's internal buffer, rdbuf.
rdbuf, (type std::string_buf), doesn't support non-copy access as per the motivation in proposal, p0408r4:
... there is no non-copying access to the internal buffer of a
basic_stringbufwhich makes at least the obtaining of the output results from anostringstreaminefficient, because a copy is always made
However, there's already a plan to support std::string move in stringsteam's constructor:
explicit basic_ostringstream( basic_string&& str, ios_base::openmode which = ios_base::out, const Allocator& a = Allocator());
AND move str()
templatevoid str(basic_string && s);