home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / foreach0.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  566b  |  30 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 "fadapter.h"
  8.  
  9. #ifdef MAIN 
  10. #define foreach0_test main
  11. #endif
  12.  
  13. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  14. using namespace std;
  15. #endif
  16. static void print(int a_)
  17. {
  18.   cout << a_ << ' ';
  19. }
  20. int foreach0_test(int, char**)
  21. {
  22.   cout<<"Results of foreach0_test:"<<endl;
  23.  
  24. int numbers[10] = { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 };
  25.  
  26.   for_each(numbers, numbers + 10, ptr_proc(print));
  27.   cout << endl;
  28.   return 0;
  29. }
  30.