Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2005-02-14 21:00:35


Howard Hinnant wrote:
> On Feb 14, 2005, at 2:52 PM, Jonathan Turkanis wrote:
>
>> Howard Hinnant wrote:
>>
>> I'd definitely like some standard way for a type to declare itself
>> tuple-like.
>> Why didn't it make it into TR1?
>>
>> I use a version of it here, to allow arbitrary tuple-like types to take
>> advantage of a form of tuple i/o:
>>
>> http://www.kangaroologic.com/format_lite/libs/format_lite/doc/?
>> path=4.2.5
>
>
> <nod> I use is_tuple_like too. It was in the original proposal. It
> got dumped somewhere along the way. I'm not sure why. When tuple was
> first voted into TR1, enable_if was brand new and pretty exotic. Parts
> of tuple that benefited from (and depended on) enable_if were dumped.
> It may be that is_tuple_like got thrown out along with that dump.
> Imho, tuple did not benefit from that exercise. We get another shot at
> it for C++0X though. So existing practice that is a little better than
> TR1 can still help.

FYI, Fusion already has the infrastructure to do that. For instance,
MPL sequences are tuple sequences and vice versa. It's a matter of
defining some helper classes that implement something akin to MPL's
TAG dispatch mechanism. Hence, a user can (in theory) make any form
of tuple-like structure play along well.

Alas, the TR1 interface is not sufficiently rich to handle all
forms of tuple like structures. In particular, get<N> assumes
O(1) access, which is obviously not always true. Fusion, like
MPL and STL uses iterators as the underlying and unifying concept.

Cheers,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk