Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without heap allocation).
More...
|
void | assign (size_type n, const T &val) |
|
template<typename InputIterator > |
void | assign (InputIterator first, InputIterator last) |
|
| prevector () |
|
| prevector (size_type n) |
|
| prevector (size_type n, const T &val) |
|
template<typename InputIterator > |
| prevector (InputIterator first, InputIterator last) |
|
| prevector (const prevector< N, T, Size, Diff > &other) |
|
| prevector (prevector< N, T, Size, Diff > &&other) noexcept |
|
prevector & | operator= (const prevector< N, T, Size, Diff > &other) |
|
prevector & | operator= (prevector< N, T, Size, Diff > &&other) noexcept |
|
size_type | size () const |
|
bool | empty () const |
|
iterator | begin () |
|
const_iterator | begin () const |
|
iterator | end () |
|
const_iterator | end () const |
|
reverse_iterator | rbegin () |
|
const_reverse_iterator | rbegin () const |
|
reverse_iterator | rend () |
|
const_reverse_iterator | rend () const |
|
size_t | capacity () const |
|
T & | operator[] (size_type pos) |
|
const T & | operator[] (size_type pos) const |
|
void | resize (size_type new_size) |
|
void | reserve (size_type new_capacity) |
|
void | shrink_to_fit () |
|
void | clear () |
|
iterator | insert (iterator pos, const T &value) |
|
void | insert (iterator pos, size_type count, const T &value) |
|
template<typename InputIterator > |
void | insert (iterator pos, InputIterator first, InputIterator last) |
|
void | resize_uninitialized (size_type new_size) |
|
iterator | erase (iterator pos) |
|
iterator | erase (iterator first, iterator last) |
|
template<typename... Args> |
void | emplace_back (Args &&...args) |
|
void | push_back (const T &value) |
|
void | pop_back () |
|
T & | front () |
|
const T & | front () const |
|
T & | back () |
|
const T & | back () const |
|
void | swap (prevector< N, T, Size, Diff > &other) noexcept |
|
| ~prevector () |
|
bool | operator== (const prevector< N, T, Size, Diff > &other) const |
|
bool | operator!= (const prevector< N, T, Size, Diff > &other) const |
|
bool | operator< (const prevector< N, T, Size, Diff > &other) const |
|
size_t | allocated_memory () const |
|
value_type * | data () |
|
const value_type * | data () const |
|
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without heap allocation).
The types Size and Diff are used to store element counts, and can be any unsigned + signed type.
Storage layout is either:
- Direct allocation:
- Size _size: the number of used elements (between 0 and N)
- T direct[N]: an array of N elements of type T (only the first _size are initialized).
- Indirect allocation:
- Size _size: the number of used elements plus N + 1
- Size capacity: the number of allocated elements
- T* indirect: a pointer to an array of capacity elements of type T (only the first _size are initialized).
The data type T must be movable by memmove/realloc(). Once we switch to C++, move constructors can be used instead.
Definition at line 38 of file prevector.h.