Difference between revisions of "CPP/STL/MultiMap"
From ProgrammingExamples
< CPP
Daviddoria (Talk | contribs) (Created page with '==MultiMap.cpp== <source lang="cpp"> #include <iostream> #include <map> int main(int argc, char *argv[]) { std::multimap <int, double> MyMap; //create a mapping from "t…') |
(No difference)
|
Revision as of 16:26, 22 June 2010
MultiMap.cpp
#include <iostream> #include <map> int main(int argc, char *argv[]) { std::multimap <int, double> MyMap; //create a mapping from "testone" to 111 MyMap.insert(std::pair<int, double>(1, 1.2)); //create an iterator std::map<int, double>::iterator iter; iter = MyMap.find(1); if(iter == MyMap.end()) { std::cout << "Not found." << std::endl; } else { std::cout << "Found: " << iter->second << std::endl; } return 0; }