On Tuesday, 18 October 2016 at 20:22:58 UTC, Andrei Alexandrescu wrote:
On 10/18/2016 04:15 PM, Atila Neves wrote:

I think I get it; I'm just not sure given the comments that pop up in the forum. Isn't one of the main reasons distinguishing between these two?

void fun(ref const Foo);
void fun(Foo);

If they can't be distinguished, you don't get move semantics "for free".

That's right, thanks Atila. -- Andreu

Is that really the only reason they aren't being allowed? Whenever I use const& in C++ I generally don't want to copy or move anything. How about adding a new qualifier?

    void func(ruleThemAll(Foo) foo);

    const Foo f;
    func(f);     // ok
    func(Foo()); // ok

// ---

    void func(ref ruleThemAll(Foo) foo);
void func(ref const Foo); // error: ruleThemAll can have no overloads that match // function(Foo) or function(ref Foo)

Reply via email to