Boost logo

Boost :

From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2003-01-06 10:46:29


David Abrahams wrote:

> My current working idea is really simple:
>
> struct impl1 { ... };
> struct impl2 { ... };
>
> template <class T>
> struct my_container : if_<is_pointer<T>, impl1, impl2>::type
> {
> ...
> };
>
> This is something I want to do all the time; it lets you swap out a
> completely different implementation for the class (well, except for
> the constructors) based on type properties. It also shows the
> convenient interaction of type_traits metafunctions with MPL
> algorithms.

OK, using this idea as a starting point...

How about a generic algorithm to stream the contents of a standard
container to cout [stream to cout is what HelloWorld is all about after
all!], using is_pointer<T> to work out whether to de-reference the
content of the iterator?

-- 
AlisdairM

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