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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.