Clash When Using Function as Template Value-Parameters?

Yuxuan Shui yshuiv7 at gmail.com
Tue May 29 11:36:11 UTC 2018


On Tuesday, 29 May 2018 at 11:34:03 UTC, Yuxuan Shui wrote:
> On Saturday, 26 May 2018 at 11:56:30 UTC, Vijay Nayar wrote:
>> I've been experimenting with code that uses std.functional : 
>> binaryFun and unaryFun, but I have found that using these 
>> methods makes it impossible to add function attributes like 
>> @safe, @nogc, pure, and nothrow, because no guarantee can be 
>> made about the functions created via a stream.  For example, 
>> if you expect a comparator function like "a == b", someone can 
>> pass in "a.data--" instead.
>>
>> [...]
>
> This is probably a bug. BTree!char.lambda is clearly not the 
> same as BTree!int.lambda, but the compiler seems to disagree?

No, wait a second. (a)=>a is in default argument list, so it is 
in the global scope. And it was instantiated when you instantiate 
BTree with char.


More information about the Digitalmars-d mailing list