Enum member isBinaryOver

Returns true if the first argument is a binary function over the next one OR two parameter arguments

enum isBinaryOver(T...) = isBinaryOver!(T[0], T[1], T[1]);

If one parameter is provided then it's duplicated.

Parameter arguments can be any compile time entity that can be typed. And the first argument can be a string that is also accpeted by std.functional.binaryFun in Phobos

Example

void f0() {}
void f1(int a) {}
void f2(int a, int b) {}

static assert(!isBinaryOver!(null, int));
static assert(!isBinaryOver!((a => a), int));
static assert( isBinaryOver!((a, b) => a + b, int));
static assert( isBinaryOver!((a, b) => a + b, int, int));

static assert(!isBinaryOver!(f0, int));
static assert(!isBinaryOver!(f1, int));
static assert( isBinaryOver!(f2, int));
static assert( isBinaryOver!(f2, int, int));
static assert(!isBinaryOver!(f2, int, string));
static assert(!isBinaryOver!(f2, int, int, int));

static assert( isBinaryOver!(f2, 3));
static assert( isBinaryOver!(f2, 3, 3));
static assert( isBinaryOver!(f2, 3, int));