1
aşağıdaki formu imzasını olan Boost.Python ile sınıf Cube
sarmak için çalışıyorum:Boost.Python veya std `için std :: tuple`` için piton tuple dönüştürme :: pair`
void insert(const std::pair< int, int>& x){ ... do something .. }
sadece bu yöntemi tamamlamayı eğer
şöyle:
.def("append", &Cube::insert, with_custodian_and_ward<1,2>())
alıyorum piton aşağıdaki hata:
ArgumentError: Python argument types in
cube.append(cube, list)
did not match C++ signature:
append(Cube {lvalue}, std::__1::pair<unsigned long, unsigned long>)
yazdığım zaman:
cube.append((1,2))
Python türünü C++ türüne doğru şekilde nasıl dönüştüreceğimi bilmiyorum. Uygun bir örnek de bulamıyorum.
.def("append", FunctionPointer([] (Cube& self, const bp::object& obj)
{
self.insert(std::make_pair(bp::extract<int>(obj[0]),bp::extract<int>(obj[1])));
}))
: