Boost logo

Boost :

Subject: Re: [boost] [move] auto-generated operator=
From: David Abrahams (dave_at_[hidden])
Date: 2009-11-16 21:35:42

on Mon Nov 16 2009, Ion Gaztañaga <> wrote:

> David Abrahams escribió:
>> On Nov 16, 2009, at 7:46 AM, David Abrahams wrote:
> m with requiring move-enablers to supply a swap.
>> In fact, I don't even think we need to do that. This seems to work pretty well:
>> public:\
>> TYPE& operator=(TYPE t)\
>> { return this->operator=(static_cast< ::boost::rv<TYPE>&>(t)); } \
>> //
> Interesting. This works for some types but it has performance impact in types
> like vector because they can't reuse previous allocated resource
> (e.g. capacity).

Yeah, but I think it might be worth the cost. Otherwise you end up with
a world where movable types in libraries are poison because, e.g., they
are incompatible with std containers.

Dave Abrahams           Meet me at BoostCon:
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at