KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a std::map called myMap in my C++ application, and I want to get an element using either myMap.find(key) or myMap[key] . However, I would also like to get the index of that element in the map. std::map<string, int> myMap; // Populate myMap with a bunch of items... myElement = myMap["myKey"]; // Now I need to get the index of myElement in myMap Is there a clean way to do that? Thank you.
Tags (comma-separated)
Save Edits
Cancel