View mode: basic / threaded / horizontal-split · Log in · Help
April 24, 2005
opAssign: a suggestion
How about allowing overloading of opAssign as long as the type of the right hand
side is not the same as the type of the left hand side. In this way a normal
assignment will still always just copy the reference as is the case at the
moment. This will help a lot when writing container classes.


class A
B data;
void opAssign(A a) {  // ERROR: rhs same type as lhs
.. }
void opAssign(B b) P  // OK!
data = b; }


Top | Discussion index | About this forum | D home