0

how can i define pair of iterator in template class with template parameter

template <typename S,typename T>
class pairMove :public pair<S,T>
{

private:
    pair< multimap<S,T>::iterator , multimap<S,T>::iterator > pairIt;

i get this error in compile time

//Error 2 error C2923: 'std::pair' : 'std::multimap::iterator' is not a valid template type argument for parameter '_Ty1'

any solution to resolve my problem

Naderi
  • 154
  • 2
  • 14

1 Answers1

6

You miss the typename keyword:

pair<typename multimap<S,T>::iterator, typename multimap<S,T>::iterator> pairIt;
     ^^^^^^^^                          ^^^^^^^^

Note that, S and T are template types; and when they are used in combination with :: operator to get another dependent type, one has to use typename.

Another nice discussion about this topic.

Community
  • 1
  • 1
iammilind
  • 68,093
  • 33
  • 169
  • 336