What are you doing inside getData? If you're changing data you need to de-constify it. This simple example works for me since the data doesn't change:
Code:
#include <iostream>
#include <vector>
template <typename T>
void getData(const std::vector<T> &data)
{
for(typename std::vector<T>::const_iterator it = data.begin();
it != data.end(); ++it)
{
std::cout << (*it) << ' ';
}
std::cout << '\n';
}
template <typename T>
void getData(const std::vector< std::vector<T> > &data)
{
// This unwraps the vectors.
for(typename std::vector< std::vector<T> >::const_iterator it = data.begin();
it != data.end(); ++it)
{
getData(*it);
}
}
int main()
{
std::vector<std::vector<std::vector<int> > > threeD(2,
std::vector<std::vector<int> >(3,
std::vector<int>(4, 7)));
getData(threeD);
}