|
Boost : |
From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-04-11 12:35:43
"David Abrahams" <david.abrahams_at_[hidden]> wrote in message
news:00f801c1e164$c8bdddb0$6801a8c0_at_boostconsulting.com...
>
> ----- Original Message -----
> From: "Fernando Cacciola" <fcacciola_at_[hidden]>
>
> > > 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.
>
> No they're not. The mpl type_list is just a user-friendly front-end over
> the other kind. It contains a nested type (which it is also derived
> from) that is formulated as you describe.
>
Aha! I see.
> > 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.
>
> I think this misapprehension has caused lots of confusion. To be very
> clear:
>
> ***** MPL's type_list is a traditional recursive type list with an easy
> interface for up to N arguments (N selectable at compile-time) *******
>
OK. This is a good thing.
BTW, is it just that I missed this fact, or is it hidden as an
implementation detail?
(I must confess that perhaps unlike most people I always look at the
implementation first... I usually find what I'm looking for faster that way;
and in this case I didn't notice the recursive type-list, so I figured it
just didn't exist)
If the later, I think it would be very beneficial to bring the recursive
type-list up-front so users know about it and actually use it just as they'd
use Loki's typelist.
-- 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