idup portable D1/D2

Frank Benoit keinfarbton at googlemail.com
Wed Mar 25 05:10:03 PDT 2009


I want to make code compilable with D1+D2.

So i thought, i can make

version(D_Version2){
} else { // D1
  string idup( char[] str ){ return str.dup; }
}

But this does not work.
D1:
str.idup;   // compile error
str.idup(); // OK

D2:
str.idup;   // OK
str.idup(); // compile error

Ideas?


More information about the Digitalmars-d-learn mailing list