home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / regression / partsum2.cpp < prev    next >
C/C++ Source or Header  |  2002-04-29  |  764b  |  33 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3. #include <iterator>
  4.  
  5. #include <vector>
  6. #include <algorithm>
  7. #include <iostream>
  8. #include <iterator>
  9. #include <functional>
  10. #include <numeric>
  11.  
  12. #ifdef MAIN 
  13. #define partsum2_test main
  14. #endif
  15.  
  16. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  17. using namespace std;
  18. #endif
  19. int partsum2_test(int, char**)
  20. {
  21.   cout<<"Results of partsum2_test:"<<endl;
  22.   vector <int> v1(5);
  23.   iota(v1.begin(), v1.end(), 1);
  24.   vector <int> v2(v1.size());
  25.   partial_sum(v1.begin(), v1.end(), v2.begin(), multiplies<int>());
  26.   ostream_iterator <int> iter(cout, " ");
  27.   copy(v1.begin(), v1.end(), iter);
  28.   cout << endl;
  29.   copy(v2.begin(), v2.end(), iter);
  30.   cout << endl;
  31.   return 0;
  32. }
  33.