Re: [C++-sig] question about implicit type conversion of vector to a custom type

2011-08-16 Thread Grant Tang
"Jim Bosch" wrote in message news:4e4ad9d9.9000...@gmail.com... On 08/16/2011 12:43 PM, Grant Tang wrote: This is a question about using implicitly_convertible to convert vector to another custom class type. I already have boost python type conversion code to convert Python list/tuple to c++

Re: [C++-sig] question about implicit type conversion of vector to a custom type

2011-08-16 Thread Jim Bosch
On 08/16/2011 12:43 PM, Grant Tang wrote: This is a question about using implicitly_convertible to convert vector to another custom class type. I already have boost python type conversion code to convert Python list/tuple to c++ vector, which works fine. There is another custom class EMObject, w

Re: [C++-sig] wrapped std::vector slice affecting items in a python list

2011-08-16 Thread Jim Bosch
On 08/16/2011 11:29 AM, Babak Khataee wrote: Okay thanks for the info. Things are also a lot safer if you only wrap vectors as const; it's exposing the mutators to Python that gets really difficult. Is the const-ness of a wrapped object just a side effect of not exposing methods which

[C++-sig] question about implicit type conversion of vector to a custom type

2011-08-16 Thread Grant Tang
This is a question about using implicitly_convertible to convert vector to another custom class type. I already have boost python type conversion code to convert Python list/tuple to c++ vector, which works fine. There is another custom class EMObject, which is a thin wrapper to many builit-in typ

Re: [C++-sig] wrapped std::vector slice affecting items in a python list

2011-08-16 Thread Babak Khataee
Okay thanks for the info. Things are also a lot safer if you only wrap vectors as const; it's exposing > the mutators to Python that gets really difficult. > Is the const-ness of a wrapped object just a side effect of not exposing methods which modify it or is it due to something else more explic

Re: [C++-sig] wrapped std::vector slice affecting items in a python list

2011-08-16 Thread Jim Bosch
On 08/16/2011 07:32 AM, babak wrote: Hi Jim Thanks for your response. I'm abit surprised that this is the case, I kind of thought that indexing_suite was there to bridge this incompatibility. Is it normal then for large projects reliant on value based containers to copy data when going from pyt

Re: [C++-sig] wrapped std::vector slice affecting items in a python list

2011-08-16 Thread babak
Hi Jim Thanks for your response. I'm abit surprised that this is the case, I kind of thought that indexing_suite was there to bridge this incompatibility. Is it normal then for large projects reliant on value based containers to copy data when going from python to c++ ? thanks babak -- View th

Re: [C++-sig] void* (void pointer) function arguments

2011-08-16 Thread Holger Joukl
Hi Jim, > > I am a bit unsure about how to work the void-pointers. A viable way seems > > to wrap the original > > API functions with thin wrappers that take a boost::python::object and hand > > the "raw" PyObject* > > into the original function: > > > > I don't see anything wrong with this approa