Duplicate another function's parameters in a template function

Justin Whear via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 20 16:20:07 PDT 2015


On Mon, 20 Apr 2015 22:50:52 +0000, Tofu Ninja wrote:

> I am trying to write a template function that can take another function
> as an alias template argument and duplicate its parameters for it self.
> 
> I tried..
> 
> auto pass(alias f, T...)(T t)
> {
>      // other stuff... return f(t);
> }
> 
> but that does not work if there is a ref parameter.
> 
> Thanks

See std.functional.forward:
http://dlang.org/phobos/std_functional.html#.forward


More information about the Digitalmars-d-learn mailing list