[C++-sig] Just about to release

Stefan Seefeld seefeld at sympatico.ca
Wed Oct 9 21:45:43 CEST 2002


the file class_operators_special_functions.html
contains special method definitions for Rational:


  class Rational
     { operator double() const; };

     Rational pow(Rational, Rational);
     Rational abs(Rational);
     ostream& operator<<(ostream&,Rational);

     class_<Rational>()
         .def(float_(self))  // __float__
         .def(pow(self))     // __pow__
         .def(abs(self))     // __abs__
         .def(str(self))     // __str__
         ;

shouldn't that read 'pow(self, other<Rational>)' ?
And what about 'str' ? How is the link to 'operator <<'
established ? Something is missing here...

Regards,
		Stefan





More information about the Cplusplus-sig mailing list