Re: [C++-sig] wrapping operator=

2009-05-25 Thread Hans Roessler
sig-bounces+wladwig=wdtinc@python.org > [cplusplus-sig-bounces+wladwig=wdtinc@python.org] On Behalf Of Hans > Roessler > [hansroess...@yahoo.de] > Sent: Monday, May 25, 2009 9:08 AM > To: cplusplus-sig@python.org > Subject: [C++-sig] wrapping operator= > > He

[C++-sig] wrapping operator=

2009-05-25 Thread Hans Roessler
Hello! I want to wrap with boost.python a C++ class "DataCube" which has overloaded the operator=. The constructor DataCube::DataCube(double x) allocates huge amounts of memory and fills it with x's. The DataCube::operator=(double x) just overwrites the already allocated memory with x's. No

[C++-sig] iterate a boost::python::list

2009-05-21 Thread Hans Roessler
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

Re: [C++-sig] variable argument number and BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS

2009-05-21 Thread Hans Roessler
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

[C++-sig] variable argument number and BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS

2009-05-21 Thread Hans Roessler
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

Re: [C++-sig] operator+(A, B) without B::B() default constructor in boost.python

2009-05-16 Thread Hans Roessler
, B) without B::B() default constructor in > boost.python > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hans Roessler schrieb: > > Hello Hans, > > in my experience .def(self+other) often didn't quite do what I expected. > You could try somet

[C++-sig] operator+(A, B) without B::B() default constructor in boost.python

2009-05-14 Thread Hans Roessler
Hello, how can I wrap the following overloaded operator+ using boost.python? The code as is fails with >... >pytest.cpp: In function ‘void init_module_pytest()’: >pytest.cpp:19: error: expected primary-expression before ‘(’ token >... If I try ".def(self+B())" instead of ".def(self+other())", the