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

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <iostream>
  5. #include <vector>
  6. #include <algorithm>
  7.  
  8. #ifdef MAIN 
  9. #define func1_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15. static bool bigger(int i_)
  16. {
  17.   return i_ > 3;
  18. }
  19. int func1_test(int, char**)
  20. {
  21.   cout<<"Results of func1_test:"<<endl;
  22.  
  23.   vector<int>v;
  24.   v.push_back(4);
  25.   v.push_back(1);
  26.   v.push_back(5);
  27.   int n = 0;
  28.   count_if(v.begin(), v.end(), bigger, n);
  29.   cout << "Number greater than 3 = " << n << endl;
  30.   return 0;
  31. }
  32.