Re: [C++-sig] returning list of class pointers that compare equal

2014-02-06 Thread Gary Oberbrunner
- Original Message - > From: "Jim Bosch" > To: "Development of Python/C++ integration" > Sent: Thursday, February 6, 2014 2:51:59 PM > Subject: Re: [C++-sig] returning list of class pointers that compare equal > > On Thu, Feb 6, 2014 at 2:43 PM, Gary Oberbrunner > wrote: > > - Ori

Re: [C++-sig] returning list of class pointers that compare equal

2014-02-06 Thread Jim Bosch
On Thu, Feb 6, 2014 at 2:43 PM, Gary Oberbrunner wrote: > - Original Message - >> From: "Jim Bosch" > ... >> - Add a __eq__/__ne__ overrides to the class of things you're >> putting >> in the list, with an implementation that compares C++ pointers, not >> Python pointers. This is almos

Re: [C++-sig] returning list of class pointers that compare equal

2014-02-06 Thread Gary Oberbrunner
- Original Message - > From: "Jim Bosch" ... > - Add a __eq__/__ne__ overrides to the class of things you're > putting > in the list, with an implementation that compares C++ pointers, not > Python pointers. This is almost certainly much easier, but it's a > little less "complete" as

Re: [C++-sig] returning list of class pointers that compare equal

2014-02-06 Thread Jim Bosch
On Thu, Feb 6, 2014 at 1:53 PM, Gary Oberbrunner wrote: > I have a function returning a bp::list, so: > > static bp::list EXTget_params(Container *g) > { > bp::list param_list; > int n_params = g->n_params; > for (int i = 0; i < n_params; i++) { > // Need this boost::ref to put a ref to

[C++-sig] returning list of class pointers that compare equal

2014-02-06 Thread Gary Oberbrunner
I have a function returning a bp::list, so: static bp::list EXTget_params(Container *g) { bp::list param_list; int n_params = g->n_params; for (int i = 0; i < n_params; i++) { // Need this boost::ref to put a ref to the param into the list // rather than a param itself. (That would