|
Boost : |
Subject: Re: [boost] [move] const rvalue failure.
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2014-08-24 20:18:49
On Sun, 24 Aug 2014 17:03:15 -0700, Mostafa
<mostafa_working_away_at_[hidden]> wrote:
> The following fails to compile on both g++ 4.8.2 and VS2005 using Boost
> 1.56:
>
> #include <boost/move/core.hpp>
> #include <boost/move/utility.hpp>
>
> struct MOC
> {
> MOC() : value(121) {}
> MOC(BOOST_RV_REF(MOC) rhs) : value(rhs.value) {}
> int value;
> private:
> //Declared and purposefully not defined.
> MOC & operator=(MOC);
> private:
> BOOST_MOVABLE_BUT_NOT_COPYABLE(MOC)
> };
>
> MOC moveonlyMutableRValue()
> {
> return MOC();
> }
>
> MOC const moveonlyConstRValue()
> {
> return MOC();
> }
>
> int main()
> {
> MOC m(moveonlyConstRValue());
>
> return 0;
> }
Forgot to add that replacing "MOC m(moveonlyConstRValue());" with "MOC
m(moveonlyMutableRValue())" compiles on both compilers.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk