Patterns for functions in template parameters
via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Oct 24 09:00:41 PDT 2014
On Friday, 24 October 2014 at 14:06:08 UTC, ketmar via
Digitalmars-d-learn wrote:
> On Thu, 23 Oct 2014 18:28:04 +0000
> Max Samukha via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com>
> wrote:
>
> um-hm... maybe this:
>
> void Foo(T, U) (T delegate (U) a) {
> // here T is bool, U is int for the following sample
> import std.stdio;
> writeln(a(3));
> }
>
> Foo((int x) => x%2 == 0);
I thought the same thing, but it doesn't compile with DMD from
Git:
test.d(7): Error: function declaration without return type. (Note
that constructors are always named 'this')
test.d(7): Error: found '=>' when expecting ')'
test.d(7): Error: no identifier for declarator Foo(int x)
test.d(7): Error: semicolon expected following function
declaration
test.d(7): Error: no identifier for declarator x
test.d(7): Error: Declaration expected, not '%'
More information about the Digitalmars-d-learn
mailing list