This function:
template<typename T1, typename T2>
typename Map<T1,T2>::Iterator insert(const std::pair<const T1, T2> &p)
when declared outside the class definition of Map
, is not a member function - it defines a global insert
.
This is a member of Map<T1, T2>
declared at namespace scope (i.e., outside the class definition):
template<typename T1, typename T2>
typename Map<T1,T2>::Iterator Map<T1,T2>::insert(const std::pair<const T1, T2> &p)
Note that the member function name has been qualified by the class name, which in this case is Map<T1, T2>
.
On a related note, using a trailing return type would let you get rid of some of the nastiness in the return type, since names in a trailing return type are resolved in the scope of the class:
template<typename T1, typename T2>
auto Map<T1, T2>::insert(const std::pair<const T1, T2> &p) -> Iterator;