나는 다음 클래스연산자 = 부스트의 :: 파이썬
class Foo
{
private:
int _bar;
public:
Foo& operator=(const Foo& other)
{
_bar = other._bar;
return *this;
}
}
부스트 :: 파이썬을 사용하여 파이썬에 해당 기능을 수출 할 수있는 간단한 방법이 있을까요 같은이 있다면? 문서는 나열하지 않고 좋은
.def(self = self)
쉽게 나는이 정직하게 필요한 경우 내가 알지도 못하는 파이썬 전문가 아닙니다. 하지만 난 내 파이썬 스크립트 에서이 기능을 원한다. 그래서 나는 단지 질문을 게시하고있다.
편집 : 나는 .DEF을 수행 할 때 여기
컴파일러 오류가 있습니다 (자기 = 자기)
.\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
]
좋아 좋은, 이것이 내가 알 필요가 정확히 무엇이다. 저는 파이썬 전문가가 아니므로 어떻게 a = b가 작동했는지 알지 못했습니다. 저는 실제로 복사 생성자와 복사 메서드가 있습니다. 연산자 = 및 복사 생성자 둘 다 copy()를 호출하므로 복사 생성자를 내보내고 호출해야합니다. 감사합니다. – Charles