Hello.
I need a template for casting arrays to another type without
changing const and immutable attributes:
template ByteType(T) {
// some magic
}
const(int)[] ca;
immutable(short)[] is;
long[] ml;
static assert(is(ByteType!ca == const(byte)[]));
static assert(is(ByteType!is ==
On Wednesday, 22 May 2013 at 13:01:26 UTC, bearophile wrote:
I think that's essentially the right solution. I suggest to
generalize it a bit, removing the byte from its insides, and
making it a template argument. I think shared is missing.
Yes.
Finally http://dpaste.1azy.net/fc503331
Jack Applegame:
Finally http://dpaste.1azy.net/fc503331
I suggest to use indents composed by 4 spaces.
Generally in D we use template constraints, instead of static ifs
with a nice error message...
In such complex situations I also suggest to add braces.
Something like this:
auto