It should work like this (untested):
boost::python::ssize_t n = boost::python::len(your_list);
for(boost::python::ssize_t i=0;i
To: Development of Python/C++ integration
Sent: Thursday, May 21, 2009 2:08:03 PM
Subject: [C++-sig] iterate a boost::python::list
How can I iterate in C++ over a
It's making a NULL pointer to a member function of A with an integer argument
and a void return type.
I'm not sure what's going on under the hood with why the NULL is required, but
I suspect that it has something to do with the fact that
void info();
void info(int i);
require two function p
How can I iterate in C++ over a boost::python::list?
According to http://www.boost.org/doc/libs/1_39_0/libs/python/doc/v2/list.html
it has no begin() and end() functions.
Neither a size() function that would allow to call pop(size()-1). Neither an
isEmpty() function that would allow to call pop
Thanks, ".def("info", (void(A::*)(int))0, A_info_overloads());" does it.
Could somebody explain what the meaning of this "(void(A::*)(int))0" construct
is? Is it a function pointer? Why the 0?
(Just now I am fine with the proposed solution, but if I even understand it,
you will read fewer stupi
Well I think that's probably the 'proper' way to do things, but I
usually use the stupid-but-obvious ways.
Overloaded functions:
Class A
{
void info_1(int i){//Do Stuff}
void info_2(){//Do Stuff}
}
class_("A")
.def("info",&A::info_1)
.def("info",&A::info_2)
Boost::p
I haven't tried this myself, but I think all you need to do to wrap the member
function is this:
.def("info", (void(A::*)(int))0, A_info_overloads());
Hope this helps,
Bill
-Original Message-
From: cplusplus-sig-bounces+wladwig=wdtinc@python.org
[mailto:cplusplus-sig-bounces+wladwi
Hello,
I try to wrap a class with a function info([int arg]) that takes either zero or
one argument (exact colde below). For some reason I can't get
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS to work.
The examples at
http://www.boost.org/doc/libs/1_39_0/libs/python/doc/tutorial/doc/html/python/fun