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;
const_reference operator[](size_t index) const
const_reverse_iterator rbegin() const
void raw_set(T *data, size_t n)
reverse_iterator rbegin()
vector container that treats its data as POD - even if it isn't in the strict sense.
const_iterator end() const
PodVector(const PodVector< T > &rhs)
void push_back(const_reference val)
const_reference front() const
const_reverse_iterator rend() const
std::reverse_iterator< const_iterator > const_reverse_iterator
const T & const_reference
std::reverse_iterator< iterator > reverse_iterator
const_iterator begin() const
reference operator[](size_t index)