Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

cpp map iterate over keys

#include <iostream>
#include <map>

int main()
{
    std::map<std::string, int> myMap;

    myMap["one"] = 1;
    myMap["two"] = 2;
    myMap["three"] = 3;

    for ( const auto &myPair : myMap ) {
        std::cout << myPair.first << "
";
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cpp #map #iterate #keys
ADD COMMENT
Topic
Name
6+1 =