home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / regression / trnsfrm1.cpp < prev    next >
C/C++ Source or Header  |  2002-04-29  |  623b  |  31 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. #ifdef MAIN 
  8. #define trnsfrm1_test main
  9. #endif
  10. static int negate_int(int a_)
  11. {
  12.   return -a_;
  13. }
  14.  
  15. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  16. using namespace std;
  17. #endif
  18. int trnsfrm1_test(int, char**)
  19. {
  20.   cout<<"Results of trnsfrm1_test:"<<endl;
  21.  
  22. int numbers[6] = { -5, -1, 0, 1, 6, 11 };
  23.  
  24.   int result[6];
  25.   transform((int*)numbers, (int*)numbers + 6, (int*)result, negate_int);
  26.   for(int i = 0; i < 6; i++)
  27.     cout << result[i] << ' ';
  28.   cout << endl;
  29.   return 0;
  30. }
  31.