Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-04-11 09:25:50


----- 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.

> 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) *******

-Dave


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