Move the string out of a std::ostringstream
This is now possible with C++20, with syntax like: const std::string s = std::move(ss).str(); This is possible because the std::ostringstream class now has a str() overload that is rvalue-ref qualified: basic_string<charT, traits, Allocator> str() &&; // since C++20 This was added in P0408, revision 7, which was adopted into C++20. This is the exact approach … Read more