更新时间:2023-11-14 16:02:40
我没有看到
std :: stringstream
构造函数接受std :: string
没错。即使 str
设置程序也不会使用移动语义,所以将一个字符串移动到 stringstream
是不可能的(不是在当前标准,但希望在未来)。
In the c++ reference I do not see a std::stringstream
constructor accepting rvalue reference of std::string
. Is there any other helper function to move string to stringstream without an overhead or is there a particular reason behind making such limitation?
I do not see a
std::stringstream
constructor accepting rvalue reference ofstd::string
That's right. Even the str
setter doesn't utilize move semantics, so moving a string into stringstream
is not possible (not in the current standard, but hopefully in the future).