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

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <algorithm>
  5. #include <iostream>
  6.  
  7. #include "unary.h"
  8.  
  9.  
  10. #ifdef MAIN 
  11. #define bcompos2_test main
  12. #endif
  13.  
  14. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  15. using namespace std;
  16. #endif
  17. int bcompos2_test(int, char**)
  18. {
  19.   cout<<"Results of bcompos2_test:"<<endl;
  20.  
  21. int array [6] = { -2, -1 , 0, 1, 2, 3 };
  22.  
  23.   int* p = find_if((int*)array, (int*)array + 6, 
  24.     compose2(logical_and<bool>(), odd(), positive()));
  25.   if(p != array + 6)
  26.     cout << *p << " is odd and positive" << endl;
  27.   return 0;
  28. }
  29.