Is using function() in templates possible at all?

Sjoerd Nijboer sjoerdnijboer at gmail.com
Wed Apr 11 22:13:33 UTC 2018


On Wednesday, 11 April 2018 at 21:29:27 UTC, Alex wrote:
> I would say, alias template parameter is your friend.
> https://dlang.org/spec/template.html#TemplateAliasParameter
>
> class SortedList(T, alias comparer)

It works, thank you!
But just to be shure, there's no way to have this more strongly 
typed in D so I can enforce that `comparer`is a funciton or 
delegate with a specific defenition?
Right now i'm relying on the template to error on some different 
place which might not give such a readable error message to the 
user.


More information about the Digitalmars-d-learn mailing list