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

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <algorithm>
  5. #include <iostream>
  6. #include <iterator>
  7. #include <string>
  8. #include <functional>
  9.  
  10. #ifdef MAIN 
  11. #define eqlrnge2_test main
  12. #endif
  13.  
  14. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  15. using namespace std;
  16. #endif
  17. int eqlrnge2_test(int, char**)
  18. {
  19.   cout<<"Results of eqlrnge2_test:"<<endl;
  20. char chars[] = "aabbccddggghhklllmqqqqssyyzz";
  21.  
  22.   const unsigned count = sizeof(chars) - 1;
  23.   ostream_iterator<char> iter(cout);
  24.   cout << "Within the collection:\n\t";
  25.   copy(chars, chars + count, iter);
  26.   pair <char*, char*> range =
  27.      equal_range((char*)chars, (char*)chars + count, 'q', less<char>());
  28.   cout
  29.     << "\nq can be inserted from before index "
  30.     <<(range.first - chars)
  31.     << " to before index "
  32.     <<(range.second - chars)
  33.     << endl;
  34.   return 0;
  35. }
  36.