|  | Bitcoin Core 22.99.0
    P2P Digital Currency | 
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without heap allocation). More...
#include <prevector.h>
| Classes | |
| class | const_iterator | 
| class | const_reverse_iterator | 
| union | direct_or_indirect | 
| class | iterator | 
| class | reverse_iterator | 
| Public Types | |
| typedef Size | size_type | 
| typedef Diff | difference_type | 
| typedef T | value_type | 
| typedef value_type & | reference | 
| typedef const value_type & | const_reference | 
| typedef value_type * | pointer | 
| typedef const value_type * | const_pointer | 
| Public Member Functions | |
| 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) | |
| prevector & | operator= (const prevector< N, T, Size, Diff > &other) | 
| prevector & | operator= (prevector< N, T, Size, Diff > &&other) | 
| 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) | 
| ~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 | 
| Private Member Functions | |
| T * | direct_ptr (difference_type pos) | 
| const T * | direct_ptr (difference_type pos) const | 
| T * | indirect_ptr (difference_type pos) | 
| const T * | indirect_ptr (difference_type pos) const | 
| bool | is_direct () const | 
| void | change_capacity (size_type new_capacity) | 
| T * | item_ptr (difference_type pos) | 
| const T * | item_ptr (difference_type pos) const | 
| void | fill (T *dst, ptrdiff_t count, const T &value=T{}) | 
| template<typename InputIterator > | |
| void | fill (T *dst, InputIterator first, InputIterator last) | 
| Private Attributes | |
| direct_or_indirect | _union = {} | 
| size_type | _size = 0 | 
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:
The data type T must be movable by memmove/realloc(). Once we switch to C++, move constructors can be used instead.
Definition at line 37 of file prevector.h.
| typedef const value_type* prevector< N, T, Size, Diff >::const_pointer | 
Definition at line 45 of file prevector.h.
| typedef const value_type& prevector< N, T, Size, Diff >::const_reference | 
Definition at line 43 of file prevector.h.
| typedef Diff prevector< N, T, Size, Diff >::difference_type | 
Definition at line 40 of file prevector.h.
| typedef value_type* prevector< N, T, Size, Diff >::pointer | 
Definition at line 44 of file prevector.h.
| typedef value_type& prevector< N, T, Size, Diff >::reference | 
Definition at line 42 of file prevector.h.
| typedef Size prevector< N, T, Size, Diff >::size_type | 
Definition at line 39 of file prevector.h.
| typedef T prevector< N, T, Size, Diff >::value_type | 
Definition at line 41 of file prevector.h.
| 
 | inline | 
Definition at line 238 of file prevector.h.
| 
 | inline | 
Definition at line 520 of file prevector.h.
| 
 | inline | 
Definition at line 218 of file prevector.h.
| 
 | inline | 
Definition at line 453 of file prevector.h.
| 
 | inline | 
Definition at line 290 of file prevector.h.
| 
 | inline | 
| 
 | inline | 
Definition at line 300 of file prevector.h.
| 
 | inlineprivate | 
Definition at line 170 of file prevector.h.
| 
 | inline | 
Definition at line 343 of file prevector.h.
| 
 | inline | 
Definition at line 528 of file prevector.h.
| 
 | inline | 
| 
 | inlineprivate | 
| 
 | inlineprivate | 
Definition at line 165 of file prevector.h.
| 
 | inline | 
Definition at line 428 of file prevector.h.
| 
 | inline | 
Definition at line 286 of file prevector.h.
| 
 | inline | 
Definition at line 292 of file prevector.h.
| 
 | inline | 
| 
 | inline | 
Definition at line 401 of file prevector.h.
| 
 | inlineprivate | 
Definition at line 209 of file prevector.h.
| 
 | inlineprivate | 
| 
 | inlineprivate | 
Definition at line 167 of file prevector.h.
| 
 | inline | 
Definition at line 347 of file prevector.h.
| 
 | inlineprivate | 
Definition at line 201 of file prevector.h.
| 
 | inlineprivate | 
| 
 | inline | 
Definition at line 493 of file prevector.h.
| 
 | inline | 
Definition at line 441 of file prevector.h.
| 
 | inline | 
Definition at line 437 of file prevector.h.
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
Definition at line 333 of file prevector.h.
| 
 | inline | 
Definition at line 316 of file prevector.h.
| 
 | inline | 
Definition at line 386 of file prevector.h.
| 
 | inline | 
Definition at line 339 of file prevector.h.
| 
 | inline | 
Definition at line 282 of file prevector.h.
| 
 | private | 
Definition at line 159 of file prevector.h.
| 
 | private | 
Definition at line 158 of file prevector.h.