What should opAssign return?

Charles D Hixson charleshixsn at earthlink.net
Mon Oct 22 19:29:32 PDT 2007


What I would expect is:

class A
{
   A opAssign(A a)
   {
      // do stuff here
      return this;
   }
}

but the only examples that I can find (variant.d) return *this 
... which leaves me quite confused.  Is this something special 
that Variant is doing to allow it to handle multiple types (I 
didn't follow the internals), or do I have what is supposed to 
be returned wrong?


More information about the Digitalmars-d-learn mailing list