Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-26 12:15:31


From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
> From: "Geurt Vos" <G.Vos_at_[hidden]>
> > > 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;
> > }
>
> Exactly. Typelists need to be instantiable because that is of help in
> passing them around to overloaded functions.

Not necessarily. You can pass type2type<Typelist> around, which is the
preferable idiom since it works with any type, references, noncopyables, and
whatnot.

--
Peter Dimov
Multi Media Ltd.

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