On Thursday, 9 June 2016 at 19:08:52 UTC, cy wrote:
But it's probably clearer to use that is(typeof({ how this
function will be called })) trick.
A very delayed thanks to both of you. It does seem like it would
be useful to have something like a hasSignature!(Fun, Ret,
Args...) defined in
The other way is better, but since you asked...
On Wednesday, 8 June 2016 at 01:42:55 UTC, Carl Vogel wrote:
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
On 6/7/16 9:42 PM, Carl Vogel wrote:
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
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,