19 #ifndef OST_POD_VECTOR_HH
20 #define OST_POD_VECTOR_HH
40 PodVector(): begin_(NULL), end_(NULL), capacity_(NULL) {}
44 this->raw_set(rhs.
data(), rhs.
size());
76 size_t capacity()
const {
return capacity_-begin_; }
77 size_t size()
const {
return end_-begin_; }
90 if (end_>=capacity_) {
91 this->do_reserve(this->capacity()*2);
110 return do_reserve(n);
115 return begin_[index];
119 return begin_[index];
123 const T*
data()
const {
return begin_; }
128 memcpy(begin_, data,
sizeof(T)*n);
132 void do_reserve(
size_t n);
135 value_type* capacity_;
138 template <
typename T>
139 void PodVector<T>::do_reserve(
size_t n)
141 size_t old_size=this->size();
143 if (n==this->capacity()) {
146 begin_=
reinterpret_cast<T*
>(realloc(begin_, n*
sizeof(T)));
147 end_=begin_+old_size;
vector container that treats its data as POD - even if it isn't in the strict sense.
const_reverse_iterator rend() const
const_reference front() const
const_iterator begin() const
std::reverse_iterator< const_iterator > const_reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
void raw_set(T *data, size_t n)
const_iterator end() const
reverse_iterator rbegin()
const_reference operator[](size_t index) const
PodVector(const PodVector< T > &rhs)
const_reverse_iterator rbegin() const
reference operator[](size_t index)
void push_back(const_reference val)
const T & const_reference