On Fri, 01 Mar 2013 18:35:43 -0500, Namespace <[email protected]> wrote:

At least I have noticed so far, that you're in any case for something like const&. Accordingly, you answer my question with 'yes, we need something like this.'.

I would say yes, we need something like rvalue references to avoid copy-paste hell. const& is not a good way to describe it, because it implies const, which this problem does not require.

This is the major problem that Andrei had with it (at least as I understand his past statements) -- it conflates const with rvalue references. Sometimes, you want a const ref that does NOT bind to an rvalue.

The one huge problem I've had with lack of rvalue references is with arithmetic operators:

struct M
{
  M opAdd(const ref M other) const {...}
}

M m;

auto m2 = (m + m) + m; // ok!
auto m3 = m + (m + m); // error!

This is crap.

-Steve

Reply via email to