Help with HashMap / typename declarations

I am working on a HashMap to learn C++ and I am using iterators and const_iterator classes to go through my HashMap. I am also using vector/list and pair to represent the Hashtable. When trying to compile, the compiler is having multiple issues with somethings such as the functions where I am using "K" and "V" which are in my typename declaration at the top of the class.

My code is here: https://pastebin.com/UsCy3WZ1

Any help or advice would be appreciated. Thanks.
The compiler doesn't know that std::list<std::pair<key_type, mapped_type>>::iterator will always be a type because std::list could have been specialized for std::pair<key_type, mapped_type> so that iterator is something else (e.g. a variable or a function) for that type. That is why you need to put typename in front of the type to tell the compiler that it should treat it as a type.

 
typename std::list<std::pair<key_type, mapped_type>>::iterator
Last edited on
Topic archived. No new replies allowed.