Skip to content

Add support for `number {operator} object`

autopybind11 is able to convert overloaded C++ operators that takes two class instances like operator*(Vector, Vector), or a class instance and a number like operator*(Vector, double), into __mul__.

However, it's not able to handle the case where the first operand is an arithmetic base type like operator*(double, Vector), which should be binded to __rmul__.

This MR provides a first solution for arithmetic types. I expect this doesn't cover the general case where the reverse operators would be required.

Merge request reports