concepts

Vlad Levenfeld via Digitalmars-d digitalmars-d at puremagic.com
Thu May 21 01:17:45 PDT 2015


How possible is something like this:

   auto foo (T)(T t)
   if (is(Eq!T) && is(Num!T) && T.sizeof == 4)
   {...}

   foo ("hello");

then you get some output from the compiler, something like

   Error: template foo cannot deduce function from argument types 
!()(string),
   candidates are:

     foo(T)(T x)
     pass is(Eq!T)
     fail is(Num!T)
     fail T.sizeof == 4

Since template code (and by extension its constraint) is known to 
the compiler, would it break anything to have it parse the 
logical connectives and state specifically what fails for each 
attempted match?


More information about the Digitalmars-d mailing list