Another way would be this:
template <typename DataType>
class MyType { ... };
template<typename X>
class A;
template<typename Y>
class A<MyType<Y>> { ...Y... };
... A<MyType<int>> ...
Thus, an instance Acan only be created with instances MyType.
If you need to create an instance of A with any type template, then a bit of different specialization is used:
template<template<typename...> X, typename Y>
class A<X<Y>> { ...X<Y>... };
... A<MyType<int>> ...
... A<OtherType<double>> ...
Thus, any template type that does not have non-type template parameters can be passed.
source
share