OpBinary

Wrap a binary operator overload.

template OpBinary (
string op
rhs_t = Guess
) if (
IsPyBinary(op) &&
op != "in"
) {}

Members

Aliases

OpBinary
alias OpBinary = BinaryOperatorX!(op, false, rhs_t)
Undocumented in source.

Parameters

op

Operator to wrap

rhs_t

(optional) Type of opBinary's parameter for disambiguation if there are multiple overloads.

Bugs

Issue 8602 prevents disambiguation for case X opBinary(string op, T)(T t);

Examples

class Foo{
    int _j;
    int opBinary(string op)(int i) if(op == "+"){
        return i+_j;
    }
    int opBinaryRight(string op)(int i) if(op == "+"){
        return i+_j;
    }
}

class_wrap!(Foo,
    OpBinary!("+"),
    OpBinaryRight!("+"));

Meta