14 #ifndef STXXL_SIMPLE_VECTOR_HEADER
15 #define STXXL_SIMPLE_VECTOR_HEADER
18 #include <stxxl/bits/noncopyable.h>
19 #include <stxxl/bits/common/types.h>
22 __STXXL_BEGIN_NAMESPACE
25 class simple_vector :
private noncopyable
28 typedef unsigned_type size_type;
29 typedef _Tp value_type;
37 typedef value_type * iterator;
38 typedef const value_type * const_iterator;
39 typedef value_type & reference;
40 typedef const value_type & const_reference;
42 simple_vector(size_type sz) : _size(sz), _array(NULL)
46 _array =
new _Tp[size()];
48 void swap(simple_vector & obj)
50 std::swap(_size, obj._size);
51 std::swap(_array, obj._array);
62 const_iterator begin()
const
66 const_iterator cbegin()
const
72 return _array + _size;
74 const_iterator end()
const
76 return _array + _size;
78 const_iterator cend()
const
82 size_type size()
const
86 reference operator [] (size_type i)
88 return *(begin() + i);
90 const_reference operator [] (size_type i)
const
92 return *(begin() + i);
100 void swap(stxxl::simple_vector<Tp_> & a,
101 stxxl::simple_vector<Tp_> & b)
107 #endif // !STXXL_SIMPLE_VECTOR_HEADER