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; }