Patterns for functions in template parameters

Max Samukha via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 23 02:23:43 PDT 2014


If I remember correctly, at some point a syntax was introduced 
for pattern-matching functions passed to templates. Something 
like:

template Foo(B(A) foo, A, B)
{
}

alias f = Foo!((int x) => x % 2 == 0);

That would instantiate Foo with B == bool, A == int and foo bound 
to the lambda.

The compiler has rejected all syntax variations I have tried and 
the specs is not helpful. Does anybody know if the feature exists 
and what is the syntax exactly?


More information about the Digitalmars-d-learn mailing list