I'm trying to define a template function that takes a container, which is also a template type. I need to know what the template type of the container is (E
) (so I can refer to it in the code, e.g. E element = *iterator;
). Here's my attempt:
template <template <typename E> T>
void sort(T& container){ ... }
I think this means "sort
is a template function that takes a template argument T
. T
is a template type that takes a template argument E
".
However I get the error:
expected 'class' before T.
When I put 'class' there, it says:
variable or field 'sort' declared void
What am I doing wrong with the syntax?