template template parameters and default arguments

template template parameters and default arguments

Post by R2VvcmdlIE » Tue, 09 Mar 2004 08:01:07


I am learning how to program with C++ Templates using the book, "C++ Templates: The Complete Guide" by Vandevoorde and Josuttis. I tried to compile one of their work arounds to account for a template template argument having to be "a template with parameters that exactly match the parameters of the template template parameter it substitutes"

Example

template<typename T
template<typename T1, typename T2 = std::allocator<T1>> class C = std::vector
class TContainer

C<T, std::allocator<T>> elems; // works with VC++.NET 7.
C<T> elems2; // error C2976: 'C' : too few template argument
..

Is there a work around for VC++.NET 7.1

George