[C++-sig] automatic conversion of tuple to vector

Michele De Stefano micdestefano at gmail.com
Tue May 25 10:16:31 CEST 2010


Jim,

actually, this IS impossible, for a limit of Boost.Python. The
explanation is into the FAQs of the Boost.Python documentation.

Basically it is not possible to develop an l-value converter, so it's
not possible to solve this problem. The author of Boost.Python
explains that for solving this problem a complete review of the
library is needed (and I hope he will do it so that in the future that
feature will be available).

Bye,
Michele

2010/5/25 Jim Bosch <talljimbo at gmail.com>:
> Hope I'm not thread-hijacking too much here, but this piqued my curiosity:
>
> On 05/25/2010 12:06 AM, Michele De Stefano wrote:
>>
>> Nathan,
>>
>> if you want to take a boost::numeric::ublas::vector instead of
>> std::vector, you can use my library (mds-utils, the link is at the end
>> of this e-mail), which already provides the proper converters.
>>
>>
>
> Do you handle the non-const reference case automatically?  More precisely,
> can you do:
>
> void func(boost::numeric::ublas::vector & arg);
> boost::python::def("func", func);
>
> ...pass it a python list, and find that list modified after the call?
>
> I've been stumped by this problem in boost python before, and I had
> previously come the conclusion that it was impossible, so I'd be very
> interested to hear it if you have a solution.
>
>
> Jim Bosch
>



-- 
Michele De Stefano
http://www.linkedin.com/in/micdestefano
http://code.google.com/p/mds-utils
http://xoomer.virgilio.it/michele_de_stefano


More information about the Cplusplus-sig mailing list