1#ifndef CONTAINER_PREALLOCATED_VECTOR_H_INCLUDED
2#define CONTAINER_PREALLOCATED_VECTOR_H_INCLUDED
5#ifndef CPPELIB_NO_STD_ITERATOR
9#include "private/TypeTraits.h"
10#include "private/Construct.h"
37#ifndef CPPELIB_NO_STD_ITERATOR
52 return "PreallocatedVector::BadAlloc";
64 : m_buf(0), m_buf_size(0
U), m_end(0
U)
120 return m_buf_size /
sizeof(
T);
192 return begin() + m_end;
197 return begin() + m_end;
200#ifndef CPPELIB_NO_STD_ITERATOR
275 destroy(&*(
end() - 1));
288 template <
typename InputIterator>
317 template <
typename InputIterator>
346 template <
typename U>
349 template <
typename Integer>
355 template <
typename InputIterator>
386 construct(&*
end(), *
it);
395 template <
typename InputIterator>
430 construct(&*
end(), *
it);
450 for (std::size_t i = 0U; i < x.
size(); ++i) {
451 if (!(x[i] == y[i])) {
#define DEBUG_ASSERT(x)
The same as CHECK_ASSERT() macro.
Definition Assertion.h:39
Definition ContainerException.h:34
Definition ContainerException.h:23
STL-like vector container using pre-allocated buffer.
Definition PreallocatedVector.h:26
void assign(size_type n, const T &data)
Definition PreallocatedVector.h:279
const_reference at(size_type idx) const
Definition PreallocatedVector.h:162
std::size_t size_type
Definition PreallocatedVector.h:29
size_type available_size() const
Definition PreallocatedVector.h:123
const_reference operator[](size_type idx) const
Definition PreallocatedVector.h:149
~PreallocatedVector()
Destructor.
Definition PreallocatedVector.h:83
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition PreallocatedVector.h:39
T value_type
Definition PreallocatedVector.h:28
const_iterator begin() const
Definition PreallocatedVector.h:185
bool empty() const
Definition PreallocatedVector.h:128
void init(void *preallocated_buffer, size_type buffer_size)
Initialize.
Definition PreallocatedVector.h:96
const value_type * const_pointer
Definition PreallocatedVector.h:36
pointer data()
Definition PreallocatedVector.h:170
void assign(InputIterator first, InputIterator last)
Definition PreallocatedVector.h:289
size_type max_size() const
Definition PreallocatedVector.h:118
size_type size() const
Definition PreallocatedVector.h:113
PreallocatedVector & operator=(const PreallocatedVector &x)
Definition PreallocatedVector.h:105
void clear()
Definition PreallocatedVector.h:138
reference front()
Definition PreallocatedVector.h:222
reference at(size_type idx)
Definition PreallocatedVector.h:154
friend bool operator==(const PreallocatedVector< U > &x, const PreallocatedVector< U > &y)
reverse_iterator rbegin()
Definition PreallocatedVector.h:201
iterator erase(iterator first, iterator last)
Definition PreallocatedVector.h:331
const value_type & const_reference
Definition PreallocatedVector.h:34
const_reference back() const
Definition PreallocatedVector.h:240
iterator end()
Definition PreallocatedVector.h:190
const value_type * const_iterator
Definition PreallocatedVector.h:32
reverse_iterator rend()
Definition PreallocatedVector.h:211
void insert(iterator pos, InputIterator first, InputIterator last)
Definition PreallocatedVector.h:318
value_type * pointer
Definition PreallocatedVector.h:35
const_iterator end() const
Definition PreallocatedVector.h:195
const_pointer data() const
Definition PreallocatedVector.h:175
value_type & reference
Definition PreallocatedVector.h:33
void pop_back()
Definition PreallocatedVector.h:272
iterator erase(iterator pos)
Definition PreallocatedVector.h:325
void resize(size_type n, const T &data=T())
Definition PreallocatedVector.h:246
std::ptrdiff_t difference_type
Definition PreallocatedVector.h:30
value_type * iterator
Definition PreallocatedVector.h:31
bool full() const
Definition PreallocatedVector.h:133
void insert(iterator pos, size_type n, const T &data)
Definition PreallocatedVector.h:311
iterator insert(iterator pos, const T &data)
Definition PreallocatedVector.h:304
PreallocatedVector()
Default constructor.
Definition PreallocatedVector.h:63
reference operator[](size_type idx)
Definition PreallocatedVector.h:144
void push_back(const T &data)
Definition PreallocatedVector.h:263
const_reference front() const
Definition PreallocatedVector.h:228
iterator begin()
Definition PreallocatedVector.h:180
std::reverse_iterator< iterator > reverse_iterator
Definition PreallocatedVector.h:38
reference back()
Definition PreallocatedVector.h:234
const_reverse_iterator rend() const
Definition PreallocatedVector.h:216
const_reverse_iterator rbegin() const
Definition PreallocatedVector.h:206
PreallocatedVector(void *preallocated_buffer, size_type buffer_size)
Constructor.
Definition PreallocatedVector.h:74
bool operator==(const Array< T, Size > &x, const Array< T, Size > &y)
Definition Array.h:160
bool operator!=(const Array< T, Size > &x, const Array< T, Size > &y)
Definition Array.h:171