Boost logo

Boost :

From: Geurt Vos (G.Vos_at_[hidden])
Date: 2001-11-26 10:56:40


>
> Have you considered using std::pair as the 'dot pair' type? It doesn't
> really matter which template is used as long as it has two
> type parameters -
> it doesn't even need a definition. std::pair is handy since
> it automatically
> maps a value list (a tuple) to a typelist.
>
> Unless you need to pass _instances_ of typelists around, of
> course. Is there such a need?
>

For testing I sometimes have code like:

std::ostream &operator <<(std::ostream &os, NullType)
{
    return os;
}

template <typename Head, class Tail>
std::ostream &operator <<(std::ostream &os, TypeList<Head,Tail>)
{
    os << typeid(Head).name() << ' ' << Tail();
    return os;
}

I also sometimes use it to iterate through a
type list, using recursive function calls. Although
that is actually a broken-compiler issue...

Geurt


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