OpBinaryRight

Wrap a binary operator overload.

  1. template OpBinary(string op, rhs_t = Guess)
  2. template OpBinaryRight(string op, lhs_t = Guess)
    template OpBinaryRight (
    string op
    lhs_t = Guess
    ) if (
    IsPyBinary(op)
    ) {}

Parameters

op

Operator to wrap

Bugs

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

Examples

1 class Foo{
2     int _j;
3     int opBinary(string op)(int i) if(op == "+"){
4         return i+_j;
5     }
6     int opBinaryRight(string op)(int i) if(op == "+"){
7         return i+_j;
8     }
9 }
10 
11 class_wrap!(Foo,
12     OpBinary!("+"),
13     OpBinaryRight!("+"));

Meta