On Thursday, 12 April 2018 at 00:05:26 UTC, Nicholas Wilson wrote:
There is, with template constraints:

class SortedList(T, alias comparer)
    if(is(typeof(comparer(T.init) : int))
{
    //...
}

If the function is declared with explicit parameter types:
```
auto list = new SortedList!(Vector3, (Vector3 v) => v.y)();
```

Then the template guard can even have a full type definition:
```
class SortedList(T, alias comparer)
    if (is(typeof(comparer) :  int function(T)))
{
    //...
}
```

Reply via email to