I was given a problem to design a function to compare two maps and see if they are equal. The value type of the maps can be primitive types like int, float etc. or containers like vector, array, or map. Here is what I get so far:
template <typename T> bool equal(T&a, T&b){
cout<<"compare nonmap"<<endl;
return a==b;
}
this works fine for maps of maps or maps of primitive types. My question is what to do with maps of vectors? Do I need to write a separate template function for vector, array and other containers? What should be the best design?