Boost logo

Boost :

Subject: Re: [boost] [operators] The future
From: Nevin Liber (nevin_at_[hidden])
Date: 2011-10-04 17:52:50


On 4 October 2011 16:05, Matt Calabrese <rivorus_at_[hidden]> wrote:

> Type&& operator +( Type&& left, Type const& right )
> {
>  left += right;
>  return std::move( left );
> }

> Anyway, as was pointed out, this is probably not a good idea for other
> reasons, such as people expecting to be able to bind the result to a
> reference and have its life extended (though I suppose you could just
> rule-out such uses as valid when the base is used).

What happens with:

Type t = TypeFactory();
auto sum = TypeFactory() + t;

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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