1
Boost.Python을 사용하여 C++ 클래스의 연산자를 오버로드하려고합니다.Boost.Python으로 연산자를 오버로드하는 방법
this에 따르면 올바른 방법으로 수행하고 있지만 컴파일러 오류가 많습니다.
Error 1 error C2064: term does not evaluate to a function taking 0 arguments c:\users\kevin\documents\visual studio 2008\projects\boostpythontest\boostpythontest\test.cpp 16 BoostPythonTest
Error 2 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 c:\users\kevin\documents\visual studio 2008\projects\boostpythontest\boostpythontest\test.cpp 16 BoostPythonTest
Error 3 error C2780: 'boost::python::class_<W> &boost::python::class_<W>::def(const char *,Fn,const A1 &,const A2 &)' : expects 4 arguments - 1 provided c:\users\kevin\documents\visual studio 2008\projects\boostpythontest\boostpythontest\test.cpp 16 BoostPythonTest
Error 4 error C2780: 'boost::python::class_<W> &boost::python::class_<W>::def(const char *,A1,const A2 &)' : expects 3 arguments - 1 provided c:\users\kevin\documents\visual studio 2008\projects\boostpythontest\boostpythontest\test.cpp 16 BoostPythonTest
Error 5 error C2780: 'boost::python::class_<W> &boost::python::class_<W>::def(const char *,F)' : expects 2 arguments - 1 provided c:\users\kevin\documents\visual studio 2008\projects\boostpythontest\boostpythontest\test.cpp 16 BoostPythonTest
내가 여기서 뭔가를 놓치고 있습니까 : 여기
#include "boost/python.hpp"
using namespace boost::python;
class number
{
public:
number(int i) : m_Number(i) { }
number operator+(int i) { return number(m_Number + i); }
private:
int m_Number;
};
BOOST_PYTHON_MODULE(test)
{
class_<number>("number", init<int>())
.def(self() + int());
}
컴파일러 오류입니다 : 여기
내가 만든 간단한 예제 문제를 정확하게 파악하기 위해 노력하고있다?
덕분에
당신은 완전히 옳았습니다. 감사합니다. – Kevin