On Fri, 08 Oct 2010 09:51:59 -0400, Simen kjaeraas <simen.kja...@gmail.com> wrote:

Steven Schveighoffer <schvei...@yahoo.com> wrote:

The correct way is to use auto ref as the parameter:

struct vec4
{
    ...
    vec4 Normalize(auto ref const(vec4) param) {...}
}

But AFAIK, this doesn't really work.

It doesn't, no. I'm not even sure it's scheduled for inclusion.

Andrei, I thought this was planned?

Also, with bugzilla #4843, overloading ref/non-ref for structs don't
work, so the only current solution is to not use ref.

Bummer. At least rvalues will be as fast as possible, and it will work as a temporary solution.

FWIW, I don't consider duplicating a function to be a good solution, we can do better.

But don't try doing opEquals without ref const, because the compiler won't allow it :)

-Steve

Reply via email to