Question: I have the following classes:

```
    template <class T, size_t dims> class dataType { ... };

    class heapType {...}; // Not templated so far.

    class dataClass {....};

```

These two classes work properly. Now I want to do the following:

```
    template < template <class T, size_t dims> class data_t, class heap_t> algorithmType {...};

```

The objective is to use `algorithmType` with the other classes as policies:

```
    algorithmType <dataType<dataClass,2>, heapType> myAlgorithm;

```

But this throws the following errors:

```
    error: ‘myAlgorithm’ was not declared in this scope
    algorithmType <dataType<dataClass,2>, heapType> myAlgorithm;
    ^

    error: expected primary-expression before ‘,’ token
    algorithmType <dataType<dataClass,2>, heapType> myAlgorithm;
                                        ^
    error: expected primary-expression before ‘>’ token
    algorithmType <dataType<dataClass,2>, heapType> myAlgorithm;
                                                  ^
    error: ‘myAlgorithm’ was not declared in this scope
    algorithmType <dataType<dataClass,2>, heapType> myAlgorithm;

```

I am following the first chapter of the Modern C++ book in which something similar is done.
where is the problem? Thank you!

Answer: 
You're declaring a template template parameter, but you're passing a *type* in, not a *template.* Either change the use and pass in a template:

```
 algorithmType <dataType, heapType> myAlgorithm;

```

Or change the declaration to accept a type:

```
template < class data_t, class heap_t> algorithmType {...};

```

Which one depends on your intended usage.

If `algorithmType` just wants a class passed in, change it to have a template type paremeter, and pass in the class `dataType<dataClass,2>` as you're doing now. It doesn't matter that the class was instantiated from a template, it's a *class.*

If, on the other hand, you want `algorithmType` to be able to provide its own template parameters to its input template parameter, keep it as a template template parameter and just pass the template in.
The problem is that `algorithmType` expects a template class accepting type and int as the first argument, and you are passing a concrete type.

To put it simpler, this is a correct way to define that variable :

```
algorithmType <dataType, heapType> myAlgorithm;

```

---

From the comment, I see that you do not understand what template class as a template argument means.

Next example compiles, and shows how to use template class as a template argument :

```
#include <list>
#include <vector>

template< template < class, class > class V >
struct A
{
    V< int, std::allocator<int> > container;
};

int main()
{
    A< std::vector > a1;  // container is std::vector<int>
    A< std::list > a2;    // container is std::map<int>
}

```

If you need to pass a concrete type, then change algorithmType to :

```
template class data_t, class heap_t> algorithmType {...};

```