What's the correct opEquals signature for structs?

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Mar 13 17:58:40 PDT 2012


On 3/14/12, Alex Rønne Petersen <xtzgzorex at gmail.com> wrote:
> void foo(S s) // compiler decides to pass by ref
> {
>      s = S(2);
> }

Well in this case it wouldn't pass by ref since it sees an assignment.
But I can see how this would become tricky business (e.g. "why is my
code slow all of a sudden"). const ref has it's uses then. :p


More information about the Digitalmars-d-learn mailing list