Constant template arguments
    bearophile via Digitalmars-d 
    digitalmars-d at puremagic.com
       
    Sat Jan  3 04:25:35 PST 2015
    
    
  
This doesn't compile because T is const(int) so you can't modify 
the arguments a and b, despite they are values:
void foo(T)(T a, T b) {
     a = b;
     b = a;
}
void main() {
     const int x, y;
     foo(x, y);
}
To make that code work I'd like to write something like this:
void foo(T)(Deconst!T a, Deconst!T b) {
Or this:
void foo(T)(@deconst T a, @deconst T b) {
Bye,
bearophile
    
    
More information about the Digitalmars-d
mailing list