Breaking the type system needs temporary?

simendsjo simen.endsjo at pandavre.com
Sat Jun 25 10:37:24 PDT 2011


I'm calling functions using ParameterTypeTuple. The problem arise when 
the parameters is defined as const/immutable. So I need to break out of 
the type system.
But I cannot seem to do this without using a temporary variable. Am I 
doing something wrong?

     int i = 1;
     const(int*) c;
     //c = &v; // ok - cannot modify const
     int* cp = cast(int*)c;
     cp = &v; // ok - breaking type system
     //(cast(int*)c) = &v; // cannot modify const - shouldn't this work 
as above?


More information about the Digitalmars-d-learn mailing list