isValidOp

Returns true if op between type T and type R is compatible and returns type convertable to E (T)

pure
bool
isValidOp
(
string op
T
R
E = T
)
()

Examples

// Assuming "this" is a vector with type "T"
auto opBinary(string op, R)(in Vector!(R, N) b) const 
if ( isValidOp(op, T, R) ) {
    // op
}
// If we want for return value to be float
auto opBinary(string op, R)(in Vector!(R, N) b) const 
if ( isValidOp(op, T, R, float) ) {
    // op
}

Meta