home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / rawiter.cpp < prev    next >
C/C++ Source or Header  |  2001-01-26  |  755b  |  41 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <iterator>
  7. #include <memory>
  8.  
  9. #ifdef MAIN 
  10. #define rawiter_test main
  11. #endif
  12.  
  13. #include "rawiter.hpp"
  14.  
  15. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  16. using namespace std;
  17. #endif
  18.  
  19. int rawiter_test(int, char**)
  20. {
  21.   cout<<"Results of rawiter_test:"<<endl;
  22.  
  23.   allocator<X> a;
  24.   typedef X* x_pointer;
  25.   x_pointer save_p, p;
  26.   p = a.allocate(5); 
  27.   save_p=p;
  28.   raw_storage_iterator<X*, X> r(p);
  29.   int i;
  30.   for(i = 0; i < 5; i++)
  31.     *r++ = X(i);
  32.   for(i = 0; i < 5; i++)
  33.     cout << *p++ << endl;
  34. # ifdef __STLPORT_VERSION
  35.   a.deallocate(save_p,5);
  36. # else
  37.   a.deallocate(save_p);
  38. # endif
  39.   return 0;
  40. }
  41.