C++11 compatible vector implementation. We needed to do some adjustments in the API since we do not use exceptions and we require a data structure which can be located fully in the shared memory.
More...
|
| vector () noexcept=default |
| creates an empty vector
|
|
| vector (const uint64_t count, const T &value) noexcept |
| creates a vector with count copies of elements with value value
|
|
| vector (const uint64_t count) noexcept |
| creates a vector with count copies of elements constructed with the default constructor of T
|
|
| vector (const vector &rhs) noexcept |
| copy constructor to copy a vector of the same capacity
|
|
| vector (vector &&rhs) noexcept |
| move constructor to move a vector of the same capacity
|
|
| ~vector () noexcept |
| destructs the vector and also calls the destructor of all contained elements
|
|
vector & | operator= (const vector &rhs) noexcept |
| copy assignment. if the destination vector contains more elements than the source the remaining elements will be destructed
|
|
vector & | operator= (vector &&rhs) noexcept |
| move assignment. if the destination vector contains more elements than the source the remaining elements will be destructed
|
|
iterator | begin () noexcept |
| returns an iterator to the first element of the vector, if the vector is empty it returns the same iterator as end (the first iterator which is outside of the vector)
|
|
const_iterator | begin () const noexcept |
| returns a const iterator to the first element of the vector, if the vector is empty it returns the same iterator as end (the first iterator which is outside of the vector)
|
|
iterator | end () noexcept |
| returns an iterator to the element which comes after the last element (the first element which is outside of the vector)
|
|
const_iterator | end () const noexcept |
| returns a const iterator to the element which comes after the last element (the first element which is outside of the vector)
|
|
T * | data () noexcept |
| return the pointer to the underlying array
|
|
const T * | data () const noexcept |
| return the const pointer to the underlying array
|
|
T & | at (const uint64_t index) noexcept |
| returns a reference to the element stored at index. the behavior
|
|
const T & | at (const uint64_t index) const noexcept |
| returns a const reference to the element stored at index. the behavior is undefined if the element at index does not exist.
|
|
T & | operator[] (const uint64_t index) noexcept |
| returns a reference to the element stored at index. the behavior
|
|
const T & | operator[] (const uint64_t index) const noexcept |
| returns a const reference to the element stored at index. the behavior is undefined if the element at index does not exist.
|
|
T & | front () noexcept |
| returns a reference to the first element; terminates if the vector is empty
|
|
const T & | front () const noexcept |
| returns a const reference to the first element; terminates if the vector is empty
|
|
T & | back () noexcept |
| returns a reference to the last element; terminates if the vector is empty
|
|
const T & | back () const noexcept |
| returns a const reference to the last element; terminates if the vector is empty
|
|
uint64_t | capacity () const noexcept |
| returns the capacity of the vector which was given via the template argument
|
|
uint64_t | size () const noexcept |
| returns the number of elements which are currently stored in the vector
|
|
bool | empty () const noexcept |
| returns true if the vector is emtpy, otherwise false
|
|
void | clear () noexcept |
| calls the destructor of all contained elements and removes them
|
|
template<typename... Targs> |
bool | resize (const uint64_t count, const Targs &... args) noexcept |
| resizes the vector. If the vector size increases new elements will be constructed with the given arguments. If count is greater than the capacity the vector will stay unchanged.
|
|
template<typename... Targs> |
bool | emplace (const uint64_t position, Targs &&... args) noexcept |
| forwards all arguments to the constructor of the contained element and performs a placement new at the provided position
|
|
template<typename... Targs> |
bool | emplace_back (Targs &&... args) noexcept |
| forwards all arguments to the constructor of the contained element and performs a placement new at the end
|
|
bool | push_back (const T &value) noexcept |
| appends the given element at the end of the vector
|
|
bool | push_back (T &&value) noexcept |
| appends the given element at the end of the vector
|
|
bool | pop_back () noexcept |
| removes the last element of the vector; calling pop_back on an empty container does nothing
|
|
iterator | erase (iterator position) noexcept |
| removes an element at the given position. if this element is in the middle of the vector every element is moved one place to the left to ensure that the elements are stored contiguously
|
|
template<typename T, uint64_t Capacity>
class iox::cxx::vector< T, Capacity >
C++11 compatible vector implementation. We needed to do some adjustments in the API since we do not use exceptions and we require a data structure which can be located fully in the shared memory.
- Attention
- Out of bounds access or accessing an empty vector can lead to a program termination!