home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / mmap2.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  956b  |  52 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3. #include <iostream>
  4. #include <map>
  5.  
  6. #ifdef MAIN 
  7. #define mmap2_test main
  8. #endif
  9.  
  10. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  11. using namespace std;
  12. #endif
  13.  
  14. int mmap2_test(int, char**)
  15. {
  16.   cout<<"Results of mmap2_test:"<<endl;
  17. static int hook=0;
  18. int bb=0;
  19.  
  20.  
  21. typedef pair<const int, char> pair_type;
  22.  
  23. pair_type p1(3, 'c');
  24. pair_type p2(6, 'f');
  25. pair_type p3(1, 'a');
  26. pair_type p4(2, 'b');
  27. pair_type p5(3, 'x');
  28. pair_type p6(6, 'f');
  29.  
  30.   typedef multimap<int, char, less<int> > mmap;
  31.  
  32. pair_type array [] =
  33.   {
  34.     p1,
  35.     p2,
  36.     p3,
  37.     p4,
  38.     p5,
  39.     p6
  40.   };
  41.  
  42.   mmap m(array+0, array + 6);
  43.   mmap::iterator i;
  44.   i = m.lower_bound(3);
  45.   cout << "lower bound:" << endl;
  46.   cout <<(*i).first << " -> " <<(*i).second << endl;
  47.   i = m.upper_bound(3);
  48.   cout << "upper bound:" << endl;
  49.   cout <<(*i).first << " -> " <<(*i).second << endl;
  50.   return 0;
  51. }
  52.