As the title says, is there a way to test the return type of the 'unaryFun' and 'binaryFun' templates from 'std.functional'?

I have the following code, and I want to to be sure that 'predicate' returns a boolean, but neither 'is(typeof(predicate) == bool)' or 'is(ReturnType!predicate == bool)' seem to work.

private alias NullSized = Nullable!(size_t, size_t.max);

public NullSized indexOf(alias pred = "a == b", Range, V)(Range array, V value)
if((isRandomAccessRange!Range || isStaticArray!Range))
{
        alias predicate = binaryFun!pred;

        for(size_t i = 0; i < array.length; i++)
                if(predicate(array[i], value))
                        return NullSized(i);
        return NullSized.init;
}

Reply via email to