#include #include #include #include "Tracer.h" using std::cout; using std::endl; using std::for_each; using std::map; using std::pair; void PrintOut(const pair &p) { cout << "PrintOut [" << p.first << "," << p.second << "]" << endl; } int main(int argc, char **argv) { Tracer a, b, c, d, e, f; map table; map::iterator it; cout << "\ninsert:" << endl; table.insert(pair(a, b)); cout << "\ninserting via operator[]:" << endl; table[c] = d; table[e] = f; cout << "\nfind via table[e]:\n" << table[e] << endl; it = table.find(c); cout << "\nPrintOut(*it), where it = table.find(c)" << endl; PrintOut(*it); cout << "\niterating:" << endl; for_each(table.begin(), table.end(), &PrintOut); cout << endl; return EXIT_SUCCESS; }