是有办法std ::移动std :: string到std :: stringstream [英] Is there a way to std::move std::string into std::stringstream
本文介绍了是有办法std ::移动std :: string到std :: stringstream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
std :: stringstream
构造函数接受 std :: string
。有没有任何其他帮助函数将字符串移动到stringstream没有开销或有特定的原因背后的限制吗?解决方案
我没有看到
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).
这篇关于是有办法std ::移动std :: string到std :: stringstream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文