Boost logo

Boost :

Subject: Re: [boost] [move] Unifying move emulation code in boost
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-01-06 07:22:23


David Abrahams wrote:

>> MovableOnly factory();
>>
>> int main()
>> {
>> MovableOnly m1(factory());
>> MovableOnly m2(MovableOnly(arg));
>> return 0;
>> }
>>
>> Maybe I'm doing something wrong but I just gave up after several tries to fix this ;-)
>
> Have you got the code and tests in the sandbox? I will be happy to take
> a crack at it.

Agggghhhhhh!!! I've lost several hours until I realized that emulation
code (and my own first example) does NOT disable copy constructor taking
a const reference!!

//Movable only type does this(like unique_ptr)

private:
unique_ptr(unique_ptr &);
unique_ptr &operator=(unique_ptr &);

instead of

private:
unique_ptr(const unique_ptr &);
unique_ptr &operator=(const unique_ptr &);

Sometimes I feel really stupid ;-)

Sorry for the noise,

Ion


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