When I have a template class which contains template map and a const_iterator
declared as in the following code by typedef
, how can I iterate through the elements of the map outside the class, f.e in main to print them on the output?
template<class K, class V>
class template_map{
private:
typedef typename std::map<K,V> TMap;
TMap my_map;
public:
typedef typename TMap::const_iterator const_iterator;
...
};
int main()
{
template_Map<int,double> Map1 //suppose that contains elements
?
}
Update: Can the typedef iterator be used outside the class? If yes in what way?