If I have something like the following class
class Foo
{
private:
int _bar;
public:
Foo& operator=( const Foo& other )
{
_bar = other._bar;
return *this;
}
}
Is there an easy way to export that functionality to python using boost::python? The documentation does not list and nice and easy
.def( self = self )
I am not an expert with python so I do not even know if this is necessary to be honest. But I want this functionality in my python scripts, so I am posting the question just to make sure.
Edit:
here are the compiler errors when I do do .def( self = self )
.\src\Python.cpp(12) : error C2780: 'boost::python::class_<W> &boost::python::class_<W>::def(const char *,Fn,const A1 &,const A2 &,const A3 &)' : expects 5 arguments - 1 provided
with
[
W=Foo
]
depends\common\include\boost/python/class.hpp(265) : see declaration of 'boost::python::class_<W>::def'
with
[
W=Foo
]
.\src\Python.cpp(12) : error C2780: 'boost::python::class_<W> &boost::python::class_<W>::def(const char *,Fn,const A1 &,const A2 &)' : expects 4 arguments - 1 provided
with
[
W=Foo
]
depends\common\include\boost/python/class.hpp(249) : see declaration of 'boost::python::class_<W>::def'
with
[
W=Foo
]
.\src\Python.cpp(12) : error C2780: 'boost::python::class_<W> &boost::python::class_<W>::def(const char *,A1,const A2 &)' : expects 3 arguments - 1 provided
with
[
W=Foo
]
depends\common\include\boost/python/class.hpp(242) : see declaration of 'boost::python::class_<W>::def'
with
[
W=Foo
]
.\src\Python.cpp(12) : error C2780: 'boost::python::class_<W> &boost::python::class_<W>::def(const char *,F)' : expects 2 arguments - 1 provided
with
[
W=Foo
]
depends\common\include\boost/python/class.hpp(233) : see declaration of 'boost::python::class_<W>::def'
with
[
W=Foo
]
.\src\Python.cpp(12) : error C2784: 'boost::python::class_<W> &boost::python::class_<W>::def(const boost::python::def_visitor<Derived> &)' : could not deduce template argument for 'const boost::python::def_visitor<Derived> &' from 'boost::python::self_ns::self_t'
with
[
W=Foo
]
depends\common\include\boost/python/class.hpp(223) : see declaration of 'boost::python::class_<W>::def'
with
[
W=Foo
]