Given this code, is it possible to change dumpStrings() to be able to iterate over any container of string, like say a list
dumpStrings()
string
list
Please try this, this would work in all container:
template void disp(T &t) { for( auto itr=t.begin();itr!=t.end();itr++) cout<<*itr< v(3,77); list l(5,"Hello"); disp(l) disp(v);
Note: Don't forget to include<string>, And auto is available in c++ 11