|
Boost : |
From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-04-11 08:57:26
----- Original Message -----
From: "David Abrahams" <david.abrahams_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, April 10, 2002 11:24 PM
Subject: Re: [boost] Re: Re: Adding Loki to Boost (reprise)
>
> ----- Original Message -----
> From: "Fernando Cacciola" <fcacciola_at_[hidden]>
>
> > I do think, however, that a pair-based type-list and its recursive
> nature
> > WILL fall short as soon as one get enthusiastic about metaprogramming,
> and
> > it is then when mpl would come to the rescue.
> >
> > As Aleksey already stated, a pair-based recursive type-list can easily
> be
> > integrated into mpl, so that when the head fails to see how to use
> recursion
> > to achieve a given side-effect (well, a pseudo side-effect); I can
> turn to
> > mpl and pretend is C++.
> >
> > So, I can't offer to help you because I don't have the time, but I
> would
> > like to see both a primitive Loki-style type-list and the mpl-style
> > type-list.
>
> What does everyone imagine the MPL type_list is if not a primitive
> Loki-style type-list? There are a few minor differences in interface,
> but in construction they are basically identical. The MPL type_list
> isn't based on std::pair, but you wouldn't want that anyway (some useful
> type lists couldn't even be instantiated if that were the case).
>
> -Dave
>
Oops! I didn't meant std::pair :-o
I meant a recursive two-element only list: ct_list<bool,ct_nil>, where more
elements are 'added' using a recursive definition: ct_list<bool,
ct_list<int, ct_list<double,ct_nil> > >
Last time I checked, an mpl type-list was like
mpl::type_list<bool,int,double>
So they are very different in nature, and I like both.
I would use the recursive form while writing simple things which I can
achieve recursively and with no side effects, and I can use mpl for the
though work, where I still can only think of it in imperative -mutating-
terms as I do all the time in C++.
AFAIK, there is no recursive <Head,Tail> sequences in mpl right now, but I
know adding it is trivial. In fact, I think that with proper work, this
recursive-list can even be made to use all the mpl algorithms.
Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk