Boost logo

Boost :

From: Hamish Mackenzie (boost_at_[hidden])
Date: 2001-11-26 11:45:28


On Mon, 2001-11-26 at 15:56, Geurt Vos wrote:
> 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;
> }

There's at least two ways around this.

template< class T > static_arg {};

std::ostream &operator <<(std::ostream &os, static_arg<type_list::nil>)
...

or

std::ostream &operator <<(std::ostream &os, type_list::nil *)
...

and pass a null pointer

Hamish


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