26 typedef _Tp value_type;
28 typedef const _Tp* const_pointer;
29 typedef _Tp& reference;
30 typedef const _Tp& const_reference;
31 typedef size_t size_type;
38#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
40 friend class boost::serialization::access;
43 void save(S &s,
const unsigned )
const {
44 s & BOOST_SERIALIZATION_NVP(p_size);
45 s & boost::serialization::make_nvp(
"p_pool", boost::serialization::make_array(p_pool, p_size));
49 void load(S &s,
const unsigned ) {
50 s & BOOST_SERIALIZATION_NVP(p_size);
52 p_pool =
new value_type[p_capacity];
53 s & boost::serialization::make_nvp(
"p_pool", boost::serialization::make_array(p_pool, p_size));
56 BOOST_SERIALIZATION_SPLIT_MEMBER();
63 iterator operator++() {
return (this->p)++; }
64 bool operator!=(
const iterator & x )
const {
return (this->p != x->p); }
65 value_type & operator*()
const {
return *(this->p); }
74 bool operator!=(
const const_iterator & x )
const {
return (this->p != x.p); }
75 const value_type & operator*()
const {
return *(this->p); }
85 : p_pool(0), p_capacity(0), p_size(0) {}
89 : p_pool(pool), p_capacity(n), p_size(n) {}
93 : p_pool(pool), p_capacity(nres), p_size(0) {
99 : p_pool(x.pool()), p_capacity(x.capacity()), p_size(x.size()) {
104 ASSERT_require(offset <= x.size());
105 p_pool = x.pool() + offset;
106 p_capacity = x.capacity() - offset;
107 p_size = x.size() - offset;
112 assert(offset+size <= x.size());
113 p_pool = x.pool() + offset;
114 p_capacity = x.capacity() - offset;
124 p_capacity = x.capacity();
135 void erase(iterator ) {
138 void erase(iterator , iterator ) {
147 void insert(iterator , const_reference ) {
150 void insert(iterator , size_type , const_reference ) {
153 void insert(iterator , iterator , iterator ) {
156 void push_back(const_reference x) {
157 assert(p_size<p_capacity);
158 p_pool[p_size++] = x;
162 iterator begin() {
return iterator(p_pool); };
163 iterator end() {
return iterator(p_pool+p_size); };
165 const_iterator begin()
const {
return const_iterator(p_pool); };
166 const_iterator end()
const {
return const_iterator(p_pool+p_size); };
169 reference operator[](size_type n) {
172 const_reference operator[](size_type n)
const {
175 reference at(size_type n) {
182 const_reference at(size_type n)
const {
189 return p_pool[p_size-1];
191 const_reference back()
const {
193 return p_pool[p_size-1];
199 const_reference front()
const {
203 pointer pool()
const {
208 size_type capacity()
const {
214 size_type max_size()
const {
217 void reserve(size_type n) {
218 assert(n<=p_capacity);
220 void resize(size_type n) {
224 assert(n<=p_capacity);
228 size_type size()
const {