I've just started experimenting with version 2 of boost.python.
In iterator.cpp, a std::list is wrapped using following code:
typedef std::list<int> list_int;
void push_back(list_int& x, int y)
{
x.push_back(y);
}
int back(list_int& x)
{
return x.back();
}
.
.
.
class_("list_int")
.def("push_back", push_back)
.def("back", back)
.def("__iter__", iterator())
;
Is it possible to use the container methods instead of user defined
functions? I've tried the code:
class_("list_int")
.def("push_back", &list_int::push_back)
.def("back", &list_int::back)
.def("__iter__", iterator())
;
This doesn't work.
Am what I'm tried to do possible?
If so, how?