equivalent of std.functional.partial for templates?

Paul Backus snarwin at gmail.com
Wed Aug 11 14:08:59 UTC 2021


On Wednesday, 11 August 2021 at 14:03:50 UTC, Paul Backus wrote:
> On Wednesday, 11 August 2021 at 14:00:33 UTC, Steven 
> Schveighoffer wrote:
>> I have a template function like this:
>>
>> ```d
>> auto foo(T, Args...)(Args args) {...}
>> ```
>>
>> If I try to bind the T only, and produce a partial template 
>> function which can accept any number of parameters, but has T 
>> already specified, I get an error, because instantiating 
>> `foo!T` means Args is length 0.
>
> https://phobos.dpldocs.info/std.meta.ApplyLeft.html

Should have read further--this does not work with template 
functions due to [issue 1807.][1] My mistake.

[1]: https://issues.dlang.org/show_bug.cgi?id=1807


More information about the Digitalmars-d-learn mailing list