Boost logo

Boost :

Subject: Re: [boost] [operators] The future
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-04 12:50:01

on Tue Oct 04 2011, Matt Calabrese <> wrote:

> type operator +( type&& left, type&& right ) required for disambiguation and
> just returns std::move( left ) + right
> If the operations return "type&&" instead of "type", they can potentially be
> more efficient, but I'm a little cautious to do that without giving it some
> thought because the choice implies subtle differences. I'm sure Daniel has
> already taken this all into consideration.

Return by value please. Otherwise:

  type const& x = type() + type();
  std::cout << x; // BOOM; x is dangling

Dave Abrahams
BoostPro Computing

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