You would need to use a template template parameter:
template <template <class> class matrixform, class input_T>
class Layer { /* ... */ };
Note that in order to use a template template parameter, the template provided as an argument must have parameters that exactly match the list. So, in this example here, only a template taking one type parameter can be used to instantiate Layer
.
This is a problem, especially since a class template parameter can have a default argument. The Boost identity_matrix
class, for example, has two template parameters: the type and the allocator to be used, so it could not be used to instantiate Layer
(the allocator parameter has a default argument).
What you can do instead is take as a template parameter the instantiated template to use, and get the input_T
from a typedef defined by that type. For example:
template <typename MatrixT>
class Layer
{
typedef typename MatrixT::value_type ValueT;
};
MatrixT
here is what matrixform<input_T>
is in your example, and ValueT
is your input_T
.
This can be instantiated as,
Layer<identity_matrix<double> > mylayer;