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

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