Why do compilers now accept to call str() member on a returned std::ostream& from std::stringstream::operator

They all added the rvalue overload (see here) at around the same time.

The rvalue overload was introduced in added to C++11 and returns the same type of stream as its left-hand operand.

As has been noted in the comments, the reason for it being added to the compilers seemingly after a whole decade is that it was added to C++11 retroactively and very recently, probably after being approved for inclusion in C++20.

I’m turning this into a community wiki in case anyone has the inclination and patience to search for the reasoning behind the retroactive addition and amend the answer.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)