2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

fix for obviously broken class Rational example

[SVN r27457]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2005-02-20 23:05:14 +00:00
parent 17faf4504c
commit bcb6370b0e

View File

@@ -661,13 +661,13 @@ similar set of intuitive interfaces can also be used to wrap C++ functions
that correspond to these Python ['special functions]. Example:
class Rational
{ operator double() const; };
{ public: operator double() const; };
Rational pow(Rational, Rational);
Rational abs(Rational);
ostream& operator<<(ostream&,Rational);
class_<Rational>()
class_<Rational>("Rational")
.def(float_(self)) // __float__
.def(pow(self, other<Rational>)) // __pow__
.def(abs(self)) // __abs__