Hi,
What's the best way, when using a Callable as a template
parameter, to constrain it by signature?
For example, if you have a function that sorts an array like so:
T[] sortArray(alias less, T)(T[] arr) { ... }
Then you know that you'd want `less` to have signature (T, T) ->
bool.
Now, I can use something like isCallable std.traits to make sure
the predicate is a Callable, and there are various function
traits in the module that I could combine with `is` clauses to
enforce the signature it seems, but that seems very clunky. Is
there a better way?
I note that I don't find many examples of this in phobos, so I'm
wondering if there actually is a good solution...
Thanks,
-c.