|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-12-17 08:09:16
Aleksey Gurtovoy <agurtovoy_at_[hidden]> writes:
> David A. Greene wrote:
>> Well, that's not creating a boost::tuple. :) I could certainly use
>> mpl::fold or some similar algorithm to create boost::tuple<int,
>> boost::tuple<...> > > > but I'm not sure that "really" a boost::tuple
>> either. cons<int, cons<...> > > > might be closer.
>
> Yep, the later will give you all the functionality of
> 'boost::tuple<int,...>' except the constructors and assignment from
> 'std::pair'. A generator for it is as simple as this:
>
> template< typename Types > struct tuple_gen
> : fold_backward<
> Types
> , boost::tuples::null_type
> , boost::tuples::cons<_2,_1>
Wow, is cons a metafunction?
It doesn't appear to be. I know we discussed making non-metafunctions
usable as MPL lambda-expressions, but I didn't think you would opt for
the transparent approach, with automatic detection of nested ::type.
I thought you were going to require some explicit wrapper
template... Not that I mind this approach.
>
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk