|
pstore2
|
A class which provides a vector-like interface to a small, normally stack allocated, buffer which may, if necessary, be resized. More...
#include <small_vector.hpp>
Public Types | |
| using | value_type = ElementType |
| using | reference = value_type & |
| using | const_reference = value_type const & |
| using | pointer = value_type * |
| using | const_pointer = value_type const * |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
| using | iterator = pointer_based_iterator< value_type > |
| using | const_iterator = pointer_based_iterator< value_type const > |
| using | reverse_iterator = std::reverse_iterator< iterator > |
| using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Public Member Functions | |
| small_vector () noexcept | |
| Constructs the buffer with an initial size of 0. | |
| small_vector (std::size_t required_elements) | |
| Constructs the buffer with the given initial number of elements. | |
| small_vector (std::initializer_list< ElementType > init) | |
| Constructs the buffer with a given initial collection of values. | |
| small_vector (small_vector &&other) noexcept | |
| small_vector (small_vector const &rhs) | |
| small_vector & | operator= (small_vector &&other) noexcept |
| small_vector & | operator= (small_vector const &other) |
| template<typename Iterator > | |
| void | append (Iterator first, Iterator last) |
Element access | |
| ElementType const * | data () const noexcept |
| ElementType * | data () noexcept |
| ElementType const & | operator[] (std::size_t n) const noexcept |
| ElementType & | operator[] (std::size_t n) noexcept |
| ElementType & | back () |
Capacity | |
Returns the number of elements. | |
| std::size_t | size () const noexcept |
| std::size_t | size_bytes () const noexcept |
| bool | empty () const noexcept |
| Checks whether the container is empty. | |
| std::size_t | capacity () const noexcept |
| Returns the number of elements that can be held in currently allocated storage. More... | |
| void | reserve (std::size_t new_cap) |
| Increase the capacity of the vector to a value that's greater or equal to new_cap. More... | |
| void | resize (std::size_t new_elements) |
| Resizes the container so that it is large enough for accommodate the given number of elements. More... | |
Iterators | |
Returns an iterator to the beginning of the container. | |
| const_iterator | begin () const noexcept |
| iterator | begin () noexcept |
| const_iterator | cbegin () noexcept |
| reverse_iterator | rbegin () noexcept |
| Returns a reverse iterator to the first element of the reversed container. More... | |
| const_reverse_iterator | rbegin () const noexcept |
| const_reverse_iterator | rcbegin () noexcept |
| const_iterator | end () const noexcept |
| Returns an iterator to the end of the container. | |
| iterator | end () noexcept |
| const_iterator | cend () noexcept |
| reverse_iterator | rend () noexcept |
| const_reverse_iterator | rend () const noexcept |
| const_reverse_iterator | rcend () noexcept |
Modifiers | |
| void | clear () noexcept |
| Removes all elements from the container. More... | |
| void | push_back (ElementType const &v) |
| Adds an element to the end. | |
| template<typename... Args> | |
| void | emplace_back (Args &&... args) |
| template<typename InputIt > | |
| void | assign (InputIt first, InputIt last) |
| void | assign (std::initializer_list< ElementType > ilist) |
| template<typename InputIt > | |
| void | append (InputIt first, InputIt last) |
| Add the specified range to the end of the small vector. | |
| void | append (std::initializer_list< ElementType > ilist) |
A class which provides a vector-like interface to a small, normally stack allocated, buffer which may, if necessary, be resized.
It is normally used to contain string buffers where they are typically small enough to be stack-allocated, but where the code must gracefully suport arbitrary lengths.
|
inlinenoexcept |
Returns the number of elements that can be held in currently allocated storage.
|
noexcept |
Removes all elements from the container.
Invalidates any references, pointers, or iterators referring to contained elements. Any past-the-end iterators are also invalidated. Unlike std::vector, the capacity of the small_vector will be reset to BodyElements.
|
inlinenoexcept |
Returns a reverse iterator to the first element of the reversed container.
It corresponds to the last element of the non-reversed container.
| void pstore::small_vector< ElementType, BodyElements >::reserve | ( | std::size_t | new_cap | ) |
Increase the capacity of the vector to a value that's greater or equal to new_cap.
If new_cap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing. reserve() does not change the size of the vector.
| new_cap | The new capacity of the vector |
| void pstore::small_vector< ElementType, BodyElements >::resize | ( | std::size_t | new_elements | ) |
Resizes the container so that it is large enough for accommodate the given number of elements.
| new_elements | The number of elements that the buffer is to accommodate. |
1.8.13