[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;
BOOST_PYTHON_MODULE(Factory)
{
class_<X>("X");
register_ptr_to_python< std::auto_ptr<X> >();
class_<FactoryX>("FactoryX",no_init)
.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)'
with
[
_Ty=X
]
Thx
More information about the Cplusplus-sig
mailing list