私はクラス本体の外側移動のコンストラクタを実装しようとしているが、それは正しくブースト移動コンパイルエラー
#include <boost/move/move.hpp>
class Test
{
BOOST_COPYABLE_AND_MOVABLE(Test)
public:
Test() {}
Test(const Test & other) { }
Test(BOOST_RV_REF(Test) other);
Test & operator=(BOOST_COPY_ASSIGN_REF(Test) other) { return *this; }
Test & operator=(BOOST_RV_REF(Test) other) { return *this; }
};
Test::Test(BOOST_RV_REF(Test) other) { }
私は私のG ++のバージョンは4.4.7
で、++グラムでこのコードをコンパイルコンパイルされません$ g++ -c test.cpp
test.cpp:15: error: prototype for 'Test::Test(boost::rv<Test>&)' does not match any in class 'Test'
test.cpp:9: error: candidates are: Test::Test(boost:rv<Test>&)
test.cpp:8: error: Test::Test(const Test&)
test.cpp:7: error: Test::Test()
MSVC 2013で正常にコンパイルされるようです。 – Tas
g ++ 5.4.0でも失敗しました。 – flyzero