Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-06-26 10:45:19


 Jeremy Siek wrote:
> Sure. The template template parameter workaround allows more
> flexibility in the template types that are used as parameters. For
> example, suppose the template parameter is a container:
>
> #include <vector>
>
> template <template <class U> class C>
> struct foo {
> struct bar { };
> C<bar> c;
> };
>
> int main()
> {
> foo<std::vector> f;
> return 0;
> }
>
>
> Now, what if we don't want to use the default allocator of
> std::vector, but some other allocator? How can we pass in std::vector into

> foo but also specify some other allocator? With template templates
> parameters you can not do this.

Actually, with template template parameters you cannot even do the above ;),

Comeau C/C++ 4.2.44 (Sep 30 2000 11:56:08) for _MS_WINDOWS_x86_BETA3

"E:\depot\libs\template_params.cpp", line 12: error #999: class template
          "std::vector" is not compatible with template template parameter
"C"
    foo<std::vector> f;
        ^


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