Skip to content

Instantly share code, notes, and snippets.

@scooby
Created February 13, 2009 23:35
Show Gist options
  • Save scooby/64166 to your computer and use it in GitHub Desktop.
Save scooby/64166 to your computer and use it in GitHub Desktop.
multimap test insert and iterating
#include <iostream>
#include <map>
using namespace std;
int main(void) {
multimap<int, int> mm;
for(int i = 20; i; i--)
mm.insert(make_pair((i * 3) & 7 + i, (i * 5) & 7));
multimap<int, int>::iterator it = mm.begin();
while(it != mm.end()) {
pair<int, int> p = *it;
cout << "k: " << p.first << ", v: " << p.second << endl;
it++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment