concepts

Dennis Ritchie via Digitalmars-d digitalmars-d at puremagic.com
Thu May 21 04:05:07 PDT 2015


Is it possible to write something like this in the compile time?

auto foo(T)(T t)
     if (is(T == immutable(int)) && t == 5)
     // Error: variable t cannot be read at compile time
{
     // ...
}

void main()
{
     immutable(int) n = 5;
     foo(n);
}


More information about the Digitalmars-d mailing list