使用或创建移动构造函数的正确方法是什么?
这是一个例子:
class Example
{
public:
Example( int && p_Number,
bool && p_YesNo,
std::string && p_String ) : // Error here
Number( p_Number ),
YesNo( p_YesNo ),
String( p_String )
{
};
private:
int Number;
bool YesNo;
std::string String;
std::vector< unsigned char > Vector;
};
void ShowExample( void )
{
Example ExampleA( 2013,
true,
"HelloWorld" // Why won't it work?
);
};
我已经在评论中显示了错误。
编辑: *好的,我现在确定我所拥有的不是移动构造函数。那么,我可以写一个吗?*