home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl2vac.zip / STLport-4_5_3.zip / STLport-4.5.3 / test / regression / ptrbinf2.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  694b  |  33 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 ptrbinf2_test main
  11. #endif
  12. static int sum(int x_, int y_)
  13. {
  14.   return x_ + y_;
  15. }
  16.  
  17. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  18. using namespace std;
  19. #endif
  20. int ptrbinf2_test(int, char**)
  21. {
  22.   cout<<"Results of ptrbinf2_test:"<<endl;
  23.  
  24. int input1 [4] = { 7, 2, 3, 5 };
  25. int input2 [4] = { 1, 5, 5, 8 };
  26.  
  27.   int output [4];
  28.   transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, ptr_fun(sum));
  29.   for(int i = 0; i < 4; i++)
  30.     cout << output[i] << endl;
  31.   return 0;
  32. }
  33.