Boost logo

Boost :

Subject: Re: [boost] [move] problem with msvc and BOOST_MOVABLE_BUT_NOT_COPYABLE
From: Ilya Sokolov (ilyasokol_at_[hidden])
Date: 2010-05-28 09:04:12


Oliver Kowalke wrote:
> I get an linker error (private: __thiscall X::X(class X &) is unresolved symbol) with msvc-9.0 on XP.
> AFAIL (docu) implementing the copy-ctor isn't required and passing values from static memeber functions are allowed.
>
> What's wrong?
>
> Oliver
>
> #include "stdafx.h"
>
> #include <boost/move/move.hpp>
>
> class X
> {
> private:
> BOOST_MOVABLE_BUT_NOT_COPYABLE( X);
> public:
> X();
> static X create();
> X( BOOST_RV_REF( X) other);
> X & operator=( BOOST_RV_REF( X) other);
> };
>
> X::X() {}
>
> X X::create()
> {
> X x;
> return x; // passing value form static memeber-fn
> }
>
> X::X( BOOST_RV_REF( X) other) {}
>
> X & X::operator=( BOOST_RV_REF( X) other)
> { return * this; }
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> X x( X::create() );
> return 0;
> }
>

Could BOOST_MOVABLE_BUT_NOT_COPYABLE be changed into CRTP base class?
It would prevent such errors at compile time. Also, it is quite
similar to boost::noncopyable.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk