Boost logo

Boost :

Subject: [boost] [move] problem with msvc-10 (BOOST_MOVABLE_BUT_NOT_COPYABLE)
From: Oliver Kowalke (k-oli_at_[hidden])
Date: 2010-11-24 15:24:01


-------- Original-Nachricht --------
Betreff: [move] problem with msvc-10 (BOOST_MOVABLE_BUT_NOT_COPYABLE)
Datum: Wed, 24 Nov 2010 20:56:46 +0100
Von: Oliver Kowalke <oliver.kowalke_at_[hidden]>
An: boost_at_[hidden]

Hi,
msvc-10 has some problems with boost.move.
linker error: LNK2019: unresolved symbol "private __cdecl X::X(class X
const&)"

Example doc_file_descriptor.cpp (uses BOOST_MOVABLE_BUT_NOT_COPYABLE)
does not compile too.

g++-4.4.5 accepts the code.

?

thx,
Oliver

#include <boost/move/move.hpp>
#include <boost/shared_ptr.hpp>

class X
{
private:
     BOOST_MOVABLE_BUT_NOT_COPYABLE( X);
     struct impl_t {};
     boost::shared_ptr< impl_t > impl_;
     X( boost::shared_ptr< impl_t > const& impl);
public:
     X();
     static X create();
     X( BOOST_RV_REF( X) other);
     X & operator=( BOOST_RV_REF( X) other);
        void swap( X & other);
};

X::X() : impl_()
{}

X::X( boost::shared_ptr< impl_t > const& impl) :
        impl_( impl)
{}

X X::create()
{
        boost::shared_ptr< impl_t > impl( new impl_t() );
        return X( impl);
}

X::X( BOOST_RV_REF( X) other) :
        impl_()
{ impl_.swap( other.impl_); }

X & X::operator=( BOOST_RV_REF( X) other)
{
        if ( this != & other)
        {
                X tmp( other);
                swap( tmp);
        }
        return * this;
}

void
X::swap( X & other)
{ impl_.swap( other.impl_); }

int main(int argc, char * argv[])
{
     X x( X::create() );
     return 0;
}


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