Bia*_*sta 3 c++ gcc move-semantics c++11
我正在尝试编译此代码:
#include <sstream>
std::stringstream foo() {
std::stringstream log;
log << "Hello there\n";
return log;
}
Run Code Online (Sandbox Code Playgroud)
GCC 4.9.2给我以下错误(带-std=c++11):
[x86-64 gcc 4.9.2] error: use of deleted function
'std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&)'
Run Code Online (Sandbox Code Playgroud)
这是一个例子.
既然std::stringstream有move constructor,为什么要调用复制构造函数,而不是移动构造函数?
注意:从GCC 5代码编译正确:见这里.
| 归档时间: |
|
| 查看次数: |
105 次 |
| 最近记录: |