How to fix opAssign signature
    Dan 
    dbdavidson at yahoo.com
       
    Fri Nov  2 05:29:14 PDT 2012
    
    
  
The following works, but I want to make opAssign in D take const 
ref D.
It needs to still print "(dup here)". How can this be done?
Thanks
Dan
----------------
import std.stdio;
struct A {
   char a[];
   this(this) { a = a.dup; writeln("(dup here)"); }
}
struct B { A a; }
struct C { B b; }
struct D {
   C c;
   // How can I make this take const ref D other
   ref D opAssign(ref D other) {
     c = other.c;
     return this;
   }
}
void main() {
   D d, d2;
   d2 = d;
}
    
    
More information about the Digitalmars-d-learn
mailing list