[C++-sig] Convert Python tuple to boost::tuple? (was Re: easy method for converting boost::tuple to python tuple?)

David Abrahams dave at boost-consulting.com
Tue Jan 31 04:28:06 CET 2006


François Duranleau <duranlef at iro.umontreal.ca> writes:

> On Mon, 23 Jan 2006, David Abrahams wrote:
>
>>    template <class H, class T>
>>    python::tuple tuple_to_python(tuples::cons<H,T> const& x)
>>    {
>>        return python::make_tuple(x) + my::tuple_to_python(x.tail);
>>    }
>                                   ^^^
>
> I guess it should rather be:
>
>          return python::make_tuple(x.head) + my::tuple_to_python(x.tail);
>                                    ^^^^^^

Yes.


>> Something like this really should be in the library already, though,
>> shouldn't it?
>
> It would certainly be very helpful.
>
> But how about doing the opposite? That is, how to easily convert a
> Python tuple to a boost::tuple automatically?
>

Yep, it's all possible.  Probably not for 1.34, though.  We have about
a week during which all new features must be finalized.  In the
meantime, I put it on the TODO list.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list