concepts
extrawurst via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 21 02:53:46 PDT 2015
On Thursday, 21 May 2015 at 08:17:47 UTC, Vlad Levenfeld wrote:
> 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?
that would be great!
More information about the Digitalmars-d
mailing list