home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl2vac.zip / STLport-4_5_3.zip / STLport-4.5.3 / test / regression / lwrbnd2.cpp < prev    next >
C/C++ Source or Header  |  2001-05-18  |  832b  |  35 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 <cstring>
  7.  
  8. #ifdef MAIN 
  9. #define lwrbnd2_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15. static bool char_str_less(const char* a_, const char* b_)
  16. {
  17.   return strcmp(a_, b_) < 0 ? 1 : 0;
  18. }
  19.  
  20. int lwrbnd2_test(int, char**)
  21. {
  22.   cout<<"Results of lwrbnd2_test:"<<endl;
  23.  
  24. char* str [] = { "a", "a", "b", "b", "q", "w", "z" };
  25.  
  26.   const unsigned strCt = sizeof(str)/sizeof(str[0]);
  27.   // DEC C++ generates incorrect template instatiation code 
  28.   // for "d" so must cast 
  29.   cout
  30.     << "d can be inserted at index: "
  31.     <<(lower_bound((char**)str,  (char**)str + strCt, (const char *)"d", char_str_less) - str)
  32.     << endl;
  33.   return 0;
  34. }
  35.