diff --git a/doc/special.html b/doc/special.html index 46ca0791..a72ec671 100644 --- a/doc/special.html +++ b/doc/special.html @@ -287,6 +287,35 @@ bignum_class.def(&rmod, "__rmod__"); found first (be it ``int`` or ``float'') will be used for either of the two types. +

Inplace Operators

+

+ Boost.Python can also be used to expose inplace numeric operations + (i.e., += and so forth). These operators must be wrapped + manually, as described in the previous section. For example, suppose + the class BigNum has an operator+=: + +

+BigNum& operator+= (BigNum const& right);
+
+ + This can be exposed by first writing a wrapper function: + +
+BigNum& iadd (BigNum& self, const BigNum& right)
+{
+  return self += right;
+}
+
+ + and then exposing the wrapper with + +
+bignum_class.def(&iadd, "__iadd__");
+
+ + + +

Coercion