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 / vec3.cpp < prev    next >
C/C++ Source or Header  |  2001-01-26  |  855b  |  33 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <iostream>
  5. #include <vector>
  6. #include <algorithm>
  7. #ifdef MAIN 
  8. #define vec3_test main
  9. #endif
  10.  
  11. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  12. using namespace std;
  13. #endif
  14. int vec3_test(int, char**)
  15. {
  16.   cout<<"Results of vec3_test:"<<endl;
  17. # ifdef __STLPORT_VERSION
  18.   typedef  __vector__<char, allocator<char> > vec_type;
  19. # else
  20.   typedef  vector<char> vec_type;
  21. # endif
  22.   vec_type v1; // Empty vector of characters.
  23.   v1.push_back('h');
  24.   v1.push_back('i');
  25.   cout << "v1 = " << v1[0] << v1[1] << endl;
  26.   vec_type v2(v1.begin(), v1.end());
  27.   v2[1] = 'o'; // Replace second character.
  28.   cout << "v2 = " << v2[0] << v2[1] << endl;
  29.   cout << "(v1 == v2) = " <<(v1 == v2) << endl;
  30.   cout << "(v1 < v2) = " <<(v1 < v2) << endl;
  31.   return 0;
  32. }
  33.