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 / insert1.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  761b  |  29 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3. #include <iostream>
  4. #include <deque>
  5. #include <algorithm>
  6.  
  7. #ifdef MAIN 
  8. #define insert1_test main
  9. #endif
  10.  
  11. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  12. using namespace std;
  13. #endif
  14.  
  15. int insert1_test(int, char**)
  16. {
  17.   cout<<"Results of insert1_test:"<<endl;
  18.   char* array1 [] = { "laurie", "jennifer", "leisa" };
  19.   char* array2 [] = { "amanda", "saskia", "carrie" };
  20.  
  21.   deque<char*> names(array1, array1 + 3);
  22.   std::deque<char*>::iterator i = names.begin() + 2;
  23.   copy(array2, array2 + 3, insert_iterator<deque <char*> >(names, i));
  24.   std::deque<char*>::iterator j;
  25.   for(j = names.begin(); j != names.end(); j++)
  26.     cout << *j << endl;
  27.   return 0;
  28. }
  29.