home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / regression / ptrunf2.cpp < prev    next >
C/C++ Source or Header  |  2002-04-29  |  612b  |  31 lines

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