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

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <algorithm>
  5. #include <vector>
  6. #include <iostream>
  7.  
  8. #ifdef MAIN 
  9. #define replif1_test main
  10. #endif
  11. static bool odd(int a_)
  12. {
  13.   return a_ % 2;
  14. }
  15.  
  16. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  17. using namespace std;
  18. #endif
  19. int replif1_test(int, char**)
  20. {
  21.   cout<<"Results of replif1_test:"<<endl;
  22.  
  23.   vector <int> v1(10);
  24.   int i;
  25.   for(i = 0; i < v1.size(); i++)
  26.   {
  27.     v1[i] = i % 5;
  28.     cout << v1[i] << ' ';
  29.   }
  30.   cout << endl;
  31.   replace_if(v1.begin(), v1.end(), odd, 42);
  32.   for(i = 0; i < v1.size(); i++)
  33.     cout << v1[i] << ' ';
  34.   cout << endl;
  35.   return 0;
  36. }
  37.