Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
after using typename for my iterator compiler couldn't recognise ->second.get. Why

C++
           typename std::map<K,V>::iterator p;

            template<class K, class V>
           /////////////////////////////
           ////////////////////////////
p = mymap.find(Key);

if(p != mymap.end())
{
    if(p->second.get() == val)//Compiler couldn't //recoginise get hy
    {
        throw 'a';//Value type cannot match value for previous key
    }
}


What I have tried:

I have spent the whole day on google over.
Posted
Updated 16-Oct-17 4:07am
v2
Comments
Jochen Arndt 16-Oct-17 8:48am    
The example code makes no sense and would not compile. p depends on K and V and I would expect it to be used within the template and not outside.

1 solution

See map Class[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900