Boost logo

Boost :

Subject: Re: [boost] [context] MinGW support?
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2011-07-27 14:30:29


Am 27.07.2011 20:00, schrieb Jeffrey Lee Hellrung, Jr.:
> On Wed, Jul 27, 2011 at 3:05 AM, Oliver Kowalke<oliver.kowalke_at_[hidden]>wrote:
> [...]
>
>> I could fix it if boost.move from trunk is used and the body of move-
>> copy-ctor and move- assignment-op for protected_stack is put inside the
>> declaration.
>>
>> don't know why bosot.move doen't allow to separate declaration and
>> definition of copy-ctor/assignm. op
>>
> Sorry, I haven't been following closely, but if Ion doesn't jump in, maybe I
> can help. Can you give more *context* (har har) to the Boost.Move issue
> you're having?
>
> - Jeff
> _______________________________________________
> Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

If definition of move-copy-ctor and move-assignment-op is separated from
its declaration
boost.move generates an compiler error (using boost.move from trunk).

lass movable
{
BOOST_MOVABLE_BUT_NOT_COPYABLE(movable)
int value_;

public:
movable() : value_(1){}

// only declaration
movable(BOOST_RV_REF(movable) m);
movable & operator=(BOOST_RV_REF(movable) m);

bool moved() const //Observer
{ return value_ == 0; }
};

movable::movable(BOOST_RV_REF(movable) m)
{ value_ = m.value_; m.value_ = 0; }

movable & movable::operator=(BOOST_RV_REF(movable) m)
{ value_ = m.value_; m.value_ = 0; return *this; }

it won't compile for gcc 4.5.2 :

movable.hpp:36:1: error: prototype for
‘movable::movable(boost::rv<movable>&)’ does not match any in class
‘movable’
movable.hpp:28:4: error: candidates are:
movable::movable(boost::rv<movable>&)
movable.hpp:25:4: error: movable::movable()
movable.hpp:21:4: error: movable::movable(movable&)
movable.hpp:39:11: error: prototype for ‘movable&
movable::operator=(boost::rv<movable>&)’ does not match any in class
‘movable’
movable.hpp:30:14: error: candidates are: movable&
movable::operator=(boost::rv<movable>&)
movable.hpp:21:4: error: movable& movable::operator=(movable&)

I've changed boost.context so that the declaration contains the
definition - now it compiles.

Oliver


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