Forwarding calls to objects of another type

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 10 19:01:19 PDT 2017


On Monday, 10 April 2017 at 21:27:34 UTC, Basile B. wrote:
>> 2) This is about the reduce templates. As I've commented, I 
>> can't use a template lambda with reduce, but I can use a 
>> lambda taking ints as arguments. Why is this? The error 
>> message I get when using the template lambda is:
>>
>> "template instance reduce!((a, b) => a + b) cannot use local 
>> '__lambda1' as parameter to non-global template reduce(alias 
>> fun)()"
>
> No idea for this.

The use of the global identity template will fix this:

see 
https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/


More information about the Digitalmars-d-learn mailing list