1 // some simple STL tests
16 map < string, int, less<string> > mymap;
18 int i, j, size, num, age;
20 // printf("max_size = %d\n", mylist.max_size());
22 for ( i = 0; i < 2000; i++ ) {
28 deque < int > :: iterator current = mylist.begin();
29 deque < int > :: iterator last = mylist.end();
32 for ( i = 0; i < 10000000; i++ ) {
33 while ( current != last ) {
40 for ( i = 0; i < 1000; i++ ) {
41 for ( j = 0; j < size; j++ ) {
52 printf("curt age = %d\n", mymap["curt"]);
53 printf("dan age = %d\n", mymap["dan"]);
56 map < string, int, less<string> > :: iterator test = mymap.find("doug");
57 if ( test == mymap.end() ) {
58 printf("doug age = not found\n");
60 printf("doug age = %d\n", (*test).second);
61 mymap.erase( "doug" );
65 map < string, int, less<string> > :: iterator mapcurrent = mymap.begin();
66 map < string, int, less<string> > :: iterator maplast = mymap.end();
67 while ( mapcurrent != maplast ) {
68 name = (*mapcurrent).first;
69 age = (*mapcurrent).second;
71 printf(" = %d\n", age);