On Saturday, 3 January 2015 at 12:45:47 UTC, bearophile wrote:
void foo(T)(Unqual!T a, Unqual!T b) { a = b; b = a; } void main() { const int x, y; foo(x, y); }Missing line: import std.traits: Unqual; Bye, bearophile
Wouldn't it be better to do this at the call site anyway? Just use a simple function.
Unqual!T unconst(T)(T val)
if (isScalarType!T)
{
return val;
}
void foo(T)(T a, T b)
{
a = b;
b = a;
}
void main()
{
const int x, y;
foo(x.unconst, y.unconst);
}
