so far I wrote this:
template <typename TType>
void print_vector(const std::vector<TType>& vec)
{
typename std::vector<TType>::const_iterator it;
std::cout << "(";
for(it = vec.begin(); it != vec.end(); it++)
{
if(it!= vec.begin()) std::cout << ",";
std::cout << (*it);
}
std::cout << ")";
}
template<>
template <typename T2>
void print_vector(const std::vector< std::vector<T2> >& vec)
{
for( auto it= vec.begin(); it!= vec.end(); it++)
{
print_vector(*it);
}
}
The first function works fine for things like std::vector< double> and so on. Now I want to be able to print std::vector< std::vector< TType>> things as well. The second part doesn't compile, but that's the "idea" I have of solving my task. Any suggestions on how to achieve that kind of behavior?
Compilation Error: too many template-parameter-lists