Boost logo

Boost :

From: troy d. straszheim (troy_at_[hidden])
Date: 2005-09-24 03:47:01


Manfred Doudar wrote:
> troy d. straszheim wrote:
>
>
>>>jarvi wrote:
>>>The implementation relies on the cons-list implementation of tuples.
>>>It is part of the public interface of Boost.Tuple, but not part of
>>>the TR1 specification. So if one wants to define serialization so
>>>that it works with any TR1 compatible tuple implementation, one must
>>>build the metafunctions around the get<N> templates. The downside of
>>>this is, that more compiler resources will be used.
>>>
>>>
>>
>>So the tuple at boost/tuple/tuple.hpp doesn't have tuple_size<>. One is
>>forced to resort to using either the cons<> stuff, or lots of
>>preprocessor stuff. I went with cons.
>>
>>
>
>
> Am I missing something here? I know that boost::tuple lacks a _size<>
> but I've always found a simple work-around with:
>
> template <typename T>
> size_t tuple_size(T tuple)
> {
> return boost::tuples::length<T>::value ;
> }
>
> ... But I agree, that convenience is lacking.
>

Ah, thank you, I somehow missed that. So no, one isn't *forced* to
depend on the cons<> interface, but somehow I ended up there on the
first go. Maybe somebody wants to add this to boost::tuples, then that
serialization routine should work with either.

-t


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