Pls just have a look at the underlined code. Why some compilation errors result form the codes?
P.S.:Dictionary.cpp:38:9: error: need ‘typename’ before ‘std::vector<std::pair<_T1, _T2> >::iterator’ because ‘std::vector<std::pair<_T1, _T2> >’ is a dependent scope
The difference is that KeyType and InfoType are template parameters, while int is not.
When encountering the expression vector<int>::iterator, the compiler can look into vector<int> and find out that iterator is a type.
When encountering vector<pair<KeyType, InfoType>>::iterator, the compiler does not yet know what kind of KeyType and InfoType this template will be instantiated with. For all it knows, you might provide a specialization of vector<pair<>> for some special KeyType and InfoType, which doesn't have an iterator typedef at all, or one where iterator is a member variable instead, and then you might instantiate this template with those types.