Re: [C++-sig] Conversion problem

2010-01-14 Thread Simon Pickles
Thanks Nicolas, I learnt a lot from your way of doing it! Simon On 13/01/2010 11:17, Nicolas Lelong wrote: Simon, it seems that I wrapped the same videoinput library you're using. I wrapped the getPixels the following way : python script is responsible of the memory allocation for pixels bu

Re: [C++-sig] Conversion problem

2010-01-13 Thread Nicolas Lelong
Simon, it seems that I wrapped the same videoinput library you're using. I wrapped the getPixels the following way : python script is responsible of the memory allocation for pixels buffer (in a correctly sized string). The getPixels function is wrapped as follows : namespace { bool video

Re: [C++-sig] Conversion problem

2010-01-13 Thread Roman Yakovenko
On Wed, Jan 13, 2010 at 11:00 AM, Simon Pickles wrote: > Hello, > > I wonder if someone could help me with a tricky conversion between c++ and > python types (well, tricky for me!) > > I have a c++ library that I would like to use in python via Boost::Python > > One function fills a c++ unsigned c

[C++-sig] Conversion problem

2010-01-13 Thread Simon Pickles
Hello, I wonder if someone could help me with a tricky conversion between c++ and python types (well, tricky for me!) I have a c++ library that I would like to use in python via Boost::Python One function fills a c++ unsigned char* buffer. It has two overloads: unsigned char * getPixe

Re: [C++-sig] conversion problem

2008-12-12 Thread Luca Sbardella
you are right, that was silly. thanks a lot 2008/12/12 Hans Meine > On Thursday 11 December 2008 16:29:34 Luca Sbardella wrote: > > The error I get is > > *error C2668: 'boost::python::make_tuple' : ambiguous call to overloaded > > function > > could be 'boost::python::tuple boost::python::make_

Re: [C++-sig] conversion problem

2008-12-12 Thread Hans Meine
On Thursday 11 December 2008 16:29:34 Luca Sbardella wrote: > The error I get is > *error C2668: 'boost::python::make_tuple' : ambiguous call to overloaded > function > could be 'boost::python::tuple boost::python::make_tuple<_Ty1,_Ty2>(const > A0 &,const A1 &)'** > or 'boost::tuples::tuple >

Re: [C++-sig] conversion problem

2008-12-12 Thread Luca Sbardella
I substituted the convert method in pair_to_tuple with the following static PyObject* convert(ctype const& v) { using namespace boost::python; list values; values.append(v.first); values.append(v.second); return incref(tuple(values)

[C++-sig] conversion problem

2008-12-11 Thread Luca Sbardella
My authomatic conversion function from std::pair does not work when one of the pair type is a boost::python::object. Template for conversion template struct pair_to_tuple { typedef pair_to_tuple converter; typedef std::pair ctype; static PyObject* convert(ctype const& v) { using namespace boos