operator double() surprise in cxx

Christophe Cavalaria chris.cavalaria at free.fr
Fri Apr 30 09:50:50 EDT 2004


John Hunter wrote:
>>>>>>"Benoît" == Benoît Dejean <bnetNOSPAM at ifrance.com> writes:
> 
>     >> double l( Py::Float(rect[0]) ); double b( Py::Float(rect[1]) );
> 
>     Benoît> everything that looks/tastes/sounds like a function
>     Benoît> declaration is (even with parameters.
> 
>   double l( Py::Float(rect[0]) );
> 
> the compiler thinks I am declaring a function l that takes Py::Float*
> as an argument and returns a double? 

Exactly

> Hmm.  This line was inside a
> class method -- I didn't think you could declare functions in a class
> method....

Well, you can declare a function nearly everywhere in fact.

> Still confused, but perhaps on the road to enlightenment.

Try that :

double l(( Py::Float(rect[0]) ));



More information about the Python-list mailing list