KTL
|
A dynamically allocated vector or trivial types. More...
#include <trivial_vector.h>
Public Types | |
typedef T * | iterator |
typedef const T * | const_iterator |
typedef std::reverse_iterator< T * > | reverse_iterator |
typedef std::reverse_iterator< const T * > | const_reverse_iterator |
Public Member Functions | |
trivial_vector () noexcept | |
Construct the vector with a default constructed allocator. More... | |
trivial_vector (const Alloc &allocator) noexcept | |
Construct the vector with the given allocator. More... | |
trivial_vector (size_t n, const Alloc &allocator=Alloc()) | |
Construct the vector with the given allocator and initial size. More... | |
trivial_vector (size_t n, const T &value, const Alloc &allocator=Alloc()) | |
Construct the vector with the given allocator, initial size and default value. More... | |
trivial_vector (std::initializer_list< T > initializer, const Alloc &allocator=Alloc()) | |
Construct the vector with the allocator and range of values. More... | |
trivial_vector (const T *first, const T *last, const Alloc &allocator=Alloc()) | |
Construct the vector with the allocator and range of values. More... | |
trivial_vector (const trivial_vector &other) noexcept | |
trivial_vector (trivial_vector &&other) noexcept | |
trivial_vector (const trivial_vector &other, const Alloc &allocator) noexcept | |
trivial_vector (trivial_vector &&other, const Alloc &allocator) noexcept | |
~trivial_vector () noexcept | |
trivial_vector & | operator= (const trivial_vector &other) noexcept |
trivial_vector & | operator= (trivial_vector &&other) noexcept |
T & | operator[] (size_t index) noexcept |
Returns a reference to the element at index . More... | |
const T & | operator[] (size_t index) const noexcept |
Returns a reference to the element at index . More... | |
iterator | begin () noexcept |
const_iterator | begin () const noexcept |
iterator | end () noexcept |
const_iterator | end () const noexcept |
reverse_iterator | rbegin () noexcept |
const_reverse_iterator | rbegin () const noexcept |
reverse_iterator | rend () noexcept |
const_reverse_iterator | rend () const noexcept |
size_t | size () const noexcept |
Returns the current size of the vector. More... | |
size_t | capacity () const noexcept |
Returns the current capacity of the vector. More... | |
bool | empty () const noexcept |
Returns true if the vector has no elements. More... | |
iterator | data () noexcept |
Returns an iterator to the start of the vector. More... | |
const_iterator | data () const noexcept |
Returns a const iterator to the start of the vector. More... | |
T & | at (size_t index) const noexcept |
Returns a reference to the element at index . More... | |
void | resize (size_t n) noexcept |
Resizes the vector to the given size. More... | |
void | reserve (size_t n) noexcept |
Reserves the capacity of the vector to n , without initializing any elements. More... | |
iterator | push_back (const T &element) noexcept |
Pushes a new element into the vector by copying it. More... | |
iterator | push_back (T &&element) noexcept |
Pushes a new element into the vector by moving it. More... | |
iterator | push_back (const T *first, const T *last) noexcept |
Pushes a range of values into the vector. More... | |
template<typename... Args> | |
iterator | emplace_back (Args &&... args) noexcept |
Pushes a new element into the vector by constructing it. More... | |
template<typename... Args> | |
void | emplace (const_iterator iter, Args &&... args) noexcept |
Inserts a new element into the vector by constructing it. More... | |
iterator | erase (const_iterator iter) noexcept |
Erases the element pointed to by the iterator. More... | |
iterator | erase (const_iterator first, const_iterator last) noexcept |
Erases all elements in a range. More... | |
T | pop_back () noexcept |
Removes the last element from the vector and returns it. More... | |
void | clear () noexcept |
Clears all elements in the vector. More... | |
A dynamically allocated vector or trivial types.
T | The type to use. Must be trivially copyable and default constructible |
Alloc | The type of allocoator to use |
typedef const T* ktl::trivial_vector< T, Alloc >::const_iterator |
typedef std::reverse_iterator<const T*> ktl::trivial_vector< T, Alloc >::const_reverse_iterator |
typedef T* ktl::trivial_vector< T, Alloc >::iterator |
typedef std::reverse_iterator<T*> ktl::trivial_vector< T, Alloc >::reverse_iterator |
|
inlinenoexcept |
Construct the vector with a default constructed allocator.
|
inlineexplicitnoexcept |
Construct the vector with the given allocator.
allocator | The allocator to use |
|
inlineexplicit |
Construct the vector with the given allocator and initial size.
n | The initial size of the vector |
allocator | The allocator to use. Will be default constructed if unspecified |
|
inlineexplicit |
Construct the vector with the given allocator, initial size and default value.
n | The initial size of the vector |
value | The value to initialize every element as |
allocator | The allocator to use. Will be default constructed if unspecified |
|
inline |
Construct the vector with the allocator and range of values.
initializer | The initial set of values |
allocator | The allocator to use. Will be default constructed if unspecified |
|
inlineexplicit |
Construct the vector with the allocator and range of values.
first | A pointer to the first element |
last | A pointer past the last element |
allocator | The allocator to use. Will be default constructed if unspecified |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Returns the current capacity of the vector.
|
inlinenoexcept |
Clears all elements in the vector.
|
inlinenoexcept |
Returns a const iterator to the start of the vector.
|
inlinenoexcept |
Returns an iterator to the start of the vector.
|
inlinenoexcept |
Inserts a new element into the vector by constructing it.
...Args | Variadic template arguments. |
iter | An iterator pointing to the location where the new element should be emplaced. |
...args | Any arguments to use in the construction of the element. |
|
inlinenoexcept |
Pushes a new element into the vector by constructing it.
...Args | Variadic template arguments. |
...args | Any arguments to use in the construction of the element. |
|
inlinenoexcept |
Returns true if the vector has no elements.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Erases all elements in a range.
first | An iterator pointing to the first element. |
last | An iterator pointing to the location after the last element. |
|
inlinenoexcept |
Erases the element pointed to by the iterator.
iter | An iterator pointing to the element. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Removes the last element from the vector and returns it.
|
inlinenoexcept |
Pushes a new element into the vector by copying it.
value | The element to copy into the vector. |
|
inlinenoexcept |
Pushes a range of values into the vector.
first | A pointer to the first element. |
last | A pointer one element past the last element. |
|
inlinenoexcept |
Pushes a new element into the vector by moving it.
value | The element to move into the vector. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Reserves the capacity of the vector to n
, without initializing any elements.
n | The minimum capacity of the vector. |
|
inlinenoexcept |
Resizes the vector to the given size.
n | The size to resize to. |
|
inlinenoexcept |
Returns the current size of the vector.