Boost logo

Boost :

Subject: Re: [boost] Movable but not copyable bug?
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2014-08-25 20:02:05


On Mon, 25 Aug 2014 14:01:18 -0700, Ion Gaztañaga <igaztanaga_at_[hidden]>
wrote:

> El 25/08/2014 18:08, Mostafa escribió:
>> On Mon, 25 Aug 2014 03:23:59 -0700, Ion Gaztañaga <igaztanaga_at_[hidden]>
>> wrote:
>>
>> [snip]
>>
>>> I also noted that you've disabled the assignment operator taking by
>>> value. I have no idea on what can happen, as Boost.Move disables also
>>> the copy assignment taking by non-const reference.
>>
>> Does that mean that when using BOOST_MOVABLE_BUT_NOT_COPYABLE clients
>> should not delete the copy constructor or the copy assignment operator?
>> If so, that should be documented.
>
> I think it's documented:
>
> http://www.boost.org/doc/libs/1_56_0/doc/html/move/movable_only_classes.html
>
> http://www.boost.org/doc/libs/1_56_0/doc/html/BOOST_MOVABLE_BUT_NOT_COPYABLE.html

Ah, ok , thanks. That information is indeed documented in the second link,
but not the first. I think it should also be documented in the first link,
since that page presents a formulaic instruction on how to use the
library. From the first link:

  To write a movable but not copyable type in portable syntax, you need to
follow these simple steps:

    - Put the following macro in the private section:
BOOST_MOVABLE_BUT_NOT_COPYABLE(classname)
    - Write a move constructor and a move assignment taking the parameter
as BOOST_RV_REF(classname)

Having BOOST_MOVABLE_BUT_NOT_COPYABLE usage requirements spread across two
pages is confusing IMO. I suggest adding the following to the above
documentation snippet:

    - Do not delete the copy constructor. (In C++03 do not declare it and
leave it undefined.)
    - Do not delete the copy assignment operator. (In C++03 do not declare
it and leave it undefined.)

Thanks,

Mostafa


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