rvalue based copy

matovitch via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 30 10:09:13 PDT 2015


Hi,

Surely I am misunderstanding something.

I got something like this :

struct S
{
     void opAssign(const ref s)
     {
         //...
     }
}

S genS()
{
     S s;
     //...
     return s;
}

main()
{
     S s;
     s = genS();
}

DMD says : ...opAssign (ref const(S) point) is not callable using 
argument types (S).

Then how to do what I wanna do ? Why doesn't this works ? (I am 
gessing ref argument explitly means no rvalue)

Thanks in advance for your help ! :)


More information about the Digitalmars-d-learn mailing list