|
Boost Users : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-11-27 23:54:17
Hi James,
A typelist is, well, a list of types :)
One easy way to create a list of types is to use std::pair to create a
lisp-style list. Suppose I want to create a list of three types: int, char,
and std::string.
typedef std::pair< int, std::pair<char, std::pair<std::string, nil> > >
MyTypeList;
The nil at the end is a type to mark the end of the list.
I can access the first thing in the list like this:
MyTypeList::first_type
I can access the second thing in the list like this:
MyTypeList::second_type::first_type
In general, one uses recursive algorithms to manipulate these kinds of
lists. You can write template metaprograms for these recursive algorithms.
Horrors! :) (I do it all the time, its fun!)
Cheers,
Jeremy
On 11/27/01 11:40 PM, "jamescurran_at_[hidden]" <jamescurran_at_[hidden]> wrote:
> Over on the Boost Developer group, there a lot of talk about how to
> best implement a typelist. Just so I can follow that discussion,
> could someone give me the basic thumbnail sketch of what exactly a
> typelist is, and what they are used for?
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
-- Jeremy Siek http://www.osl.iu.edu/~jsiek Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden] C++ Booster (http://www.boost.org) office phone: (812) 855-3608
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net