Inspecting lambda parameters

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 10 12:05:50 PDT 2014


On 2014-05-10 18:56, Meta wrote:

> Wasn't there recently a pull request to add TemplateArgsOf, or something
> like that.

There's this pull request [1] that adds a couple of new traits that 
might help.

> Also, if you know what type the lambda is going to be
> instantiated with, you can turn it into a function by doing:
>
> void foo (alias func) ()
> {
>      alias Types = ParameterTypeTuple!(func!int);
> }

Unfortunately I don't know the types it's going to be instantiated with. 
That's part of the introspecting to figure out.

[1] https://github.com/D-Programming-Language/dmd/pull/3515

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list