Is there a standard for whar opAssign/opOpAssign should return?

HSteffenhagen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 6 07:25:46 PST 2016


In the https://dlang.org/spec/operatoroverloading.html opAssign
is declared as

void opAssign(S rhs);

in the example.

 From C++ I'm used to return *this when overloading assignment 
operators to allow chaining of assignments (or somewhat more 
rarely, weird tricks for if and while statements), is that not 
done in D as a rule or is the example just weird? Same question 
for the
opOpAssign family.




More information about the Digitalmars-d-learn mailing list