casting with preserving attributes

Jack Applegame japplegame at gmail.com
Wed May 22 05:51:38 PDT 2013


I found awkward solution:

template ByteType(alias t) {
   alias typeof(t) T;
   static if(is(ElementType!T == const)) alias const(byte)[] 
ByteType;
   else static if(is(ElementType!T == immutable)) alias 
immutable(byte)[] ByteType;
   else alias byte[] ByteType;
}



More information about the Digitalmars-d-learn mailing list