There are three different kinds of template arguments: values, types, and templates:
template <int value_argument> class C { };
template <class type_argument> class D { };
template <template<classT> class template_argument> class E { };
When you use these templates you have to provide an argument of the correct kind:
C<3> c;
D<int> d;
E<C> e;
When you use the third form, a template template argument, the template passed as the argument must match the declaration of the template template argument. In my simple examples, the template E
expects a template template argument that takes one type argument.
In the code in the question, the first argument in the declaration of Foobar
is template <class> class TContainer
. At the point where it's used, the template that's passed is std::vector
:
Foobar<std::vector, IUnknown*> bla(v);
The problem is that the template template argument says that it should have one argument, but the template that's passed as the actual argument has two or more. Formally, std::vector
is
template <class T, class Allocator = std::allocator<T>> class vector { ... };
In order to use std::vector> as the first argument to
Foobar, the definition of
Foobar` needs to be changed so that the first argument takes two type arguments:
template <template<class, class> TContainer, class TObject> class Foobar { ... };