[C++-sig] Overloaded Member functions

Julien swell at netcourrier.com
Fri Feb 17 12:21:57 CET 2006

Hi ,
   Still playing around the boost python wrapper/generator. 

i have this structure that i want to wrap :

struct X

struct FactoryX
  static std::auto_ptr<X> create() 	 {return std::auto_ptr<X>( new X() );}
  static std::auto_ptr<X> create(int) 	 {return std::auto_ptr<X>( new X() );}
  static std::auto_ptr<X> create(double) {return std::auto_ptr<X>( new X() );}

i try this but can't get it work!

std::auto_ptr<X> (FactoryX::*create1)() 	= &FactoryX::create;
std::auto_ptr<X> (FactoryX::*create2)(int) 	= &FactoryX::create;
std::auto_ptr<X> (FactoryX::*create3)(double) 	= &FactoryX::create;

  register_ptr_to_python< std::auto_ptr<X> >();
     .def("create", create1)
     .def("create", create2)
     .def("create", create3)

My thought on that is that it is a compiler specific pb . I am using Visual 
studio 2003 , does some of you succeed to define overloaded member functions 
under this compiler? The compiler tells me :

error C2440: 'type cast' : cannot convert from 'overloaded-function' 
to 'std::auto_ptr<_Ty> (__thiscall FactoryX::* )(void)'


More information about the Cplusplus-sig mailing list