![]() |
LLGL 0.05 Beta
|
Generic container class for consecutive arrays optimized for small sizes. More...
#include <SmallVector.h>
Public Types | |
| using | value_type = T |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
| using | reference = value_type& |
| using | const_reference = const value_type& |
| using | pointer = value_type* |
| using | const_pointer = const value_type* |
| using | iterator = value_type* |
| using | const_iterator = const value_type* |
| using | reverse_iterator = std::reverse_iterator<iterator> |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
Public Member Functions | |
| SmallVector () | |
| Default initializes an empty vector. | |
| SmallVector (const SmallVector &other) | |
Initializes the vector with a copy of all elements from the other vector. | |
| template<typename OtherT, std::size_t OtherLocalCapacity, typename OtherAllocator, typename OtherGrowStrategy> | |
| SmallVector (const SmallVector< OtherT, OtherLocalCapacity, OtherAllocator, OtherGrowStrategy > &other) | |
Initializes the vector with a copy of all elements from the other vector of different type. | |
| SmallVector (SmallVector &&other) | |
Takes the ownership of dynamically allocated elements from the other vector or copies all elements if the dynamic allocation is not used yet. | |
| template<typename InputIter> | |
| SmallVector (InputIter from, InputIter to) | |
Initializes the vector with the specified elements in the half-open range [from, to). | |
| SmallVector (const std::initializer_list< T > &list) | |
| Initializes the vector with a copy of all elements from the specified initializer list. | |
| template<template< typename, typename > class OtherContainer, typename OtherAllocator> | |
| SmallVector (const OtherContainer< T, OtherAllocator > &other) | |
Initializes the vector with a copy of all elements from the other generic container. | |
| SmallVector (ArrayView< T > list) | |
| Initializes the vector with a copy of all elements from the specified array view. | |
| template<std::size_t N> | |
| SmallVector (const T(&data)[N]) | |
| Initializes the vector with a copy of all elements from the specified data with a fixed size array. | |
| SmallVector (size_type count) | |
| Initializes the vector with the specified number of elements and initial default value. | |
| SmallVector (size_type count, const value_type &value) | |
| Initializes the vector with the specified number of elements and initial value. | |
| SmallVector (size_type count, UninitializeTag) | |
| Pre-allocates the vector with the specified number of elements but keeps them all uninitialized. | |
| ~SmallVector () | |
| Destroys all elements in this vector. | |
| bool | empty () const noexcept |
| Returns true if this vector is empty. | |
| size_type | size () const noexcept |
| Returns the size (in number of elements) of this vector. | |
| size_type | capacity () const noexcept |
| Returns the internal capacity (in number of elements) of this vector. This refers to the memory allocated for this vector. | |
| pointer | data () noexcept |
| Returns a pointer to the beginning of this vector. | |
| const_pointer | data () const noexcept |
| Returns a constant pointer to the beginning of this vector. | |
| reference | at (size_type pos) |
| Returns a reference to the element at the specified position in this vector. | |
| const_reference | at (size_type pos) const |
| Returns a constant reference to the element at the specified position in this vector. | |
| reference | front () |
| Returns a reference to first element in this vector. | |
| const_reference | front () const |
| Returns a constant reference to first element in this vector. | |
| reference | back () |
| Returns a reference to last element in this vector. | |
| const_reference | back () const |
| Returns a constant reference to last element in this vector. | |
| void | clear () |
| Destroys all elements in this vector. | |
| void | resize (size_type size) |
| Resizes this vector to the new size and default initializes all newly allocated elements. | |
| void | resize (size_type size, const value_type &value) |
| Resizes this vector to the new size and explicitly initializes all newly allocated elements. | |
| void | resize (size_type size, UninitializeTag) |
| Resizes this vector to the new size and explicitly keeps all newly elements uninitialized. | |
| void | reserve (size_type size) |
Reserves memory for this vector to hold at least size elements. | |
| void | shrink_to_fit () |
| Re-allocates the internal memory for this vector to fit precisely the current number of elements. | |
| void | push_back (const value_type &value) |
| void | push_back (value_type &&value) |
| void | pop_back () |
| iterator | insert (const_iterator pos, const value_type &value) |
| template<typename InputIter> | |
| iterator | insert (const_iterator pos, InputIter from, InputIter to) |
| iterator | insert (const_iterator pos, const std::initializer_list< T > &list) |
| iterator | erase (const_iterator pos) |
| iterator | erase (const_iterator from, const_iterator to) |
| void | swap (SmallVector &other) |
| iterator | begin () noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | cbegin () const noexcept |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | crbegin () const |
| iterator | end () noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cend () const noexcept |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
| const_reverse_iterator | crend () const |
| SmallVector & | operator= (const SmallVector &rhs) |
| template<typename OtherT, std::size_t OtherLocalCapacity, typename OtherAllocator, typename OtherGrowStrategy> | |
| SmallVector & | operator= (const SmallVector< OtherT, OtherLocalCapacity, OtherAllocator, OtherGrowStrategy > &rhs) |
| SmallVector & | operator= (SmallVector &&rhs) |
Takes the ownership of dynamically allocated elements from the rhs vector or copies all elements if the dynamic allocation is not used yet. | |
| const_reference | operator[] (size_type pos) const |
| reference | operator[] (size_type pos) |
| operator ArrayView< T > () const | |
Generic container class for consecutive arrays optimized for small sizes.
| T | Specifies the array element type. |
| LocalCapacity | Specifies the capacity of the local buffer. Up to this number of elements no dynamic memory allocation is necessary. By default 16. |
| Allocator | Specifies the memory allocator. This has to be compatible with std::allocator. By default std::allocator<T>. |
| GrowStrategy | Specifies the strategy to grow the internal storage when the container switched to heap allocations. By default GrowStrategyAddHalf. |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::const_iterator = const value_type* |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::const_pointer = const value_type* |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::const_reference = const value_type& |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::difference_type = std::ptrdiff_t |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::iterator = value_type* |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::pointer = value_type* |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::reference = value_type& |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::reverse_iterator = std::reverse_iterator<iterator> |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::size_type = std::size_t |
| using LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::value_type = T |
|
inline |
Default initializes an empty vector.
|
inline |
Initializes the vector with a copy of all elements from the other vector.
|
inline |
Initializes the vector with a copy of all elements from the other vector of different type.
|
inline |
Takes the ownership of dynamically allocated elements from the other vector or copies all elements if the dynamic allocation is not used yet.
|
inline |
Initializes the vector with the specified elements in the half-open range [from, to).
|
inline |
Initializes the vector with a copy of all elements from the specified initializer list.
|
inline |
Initializes the vector with a copy of all elements from the other generic container.
|
inline |
Initializes the vector with a copy of all elements from the specified array view.
|
inline |
Initializes the vector with a copy of all elements from the specified data with a fixed size array.
<N>.
|
inlineexplicit |
Initializes the vector with the specified number of elements and initial default value.
|
inlineexplicit |
Initializes the vector with the specified number of elements and initial value.
|
inlineexplicit |
Pre-allocates the vector with the specified number of elements but keeps them all uninitialized.
|
inline |
Destroys all elements in this vector.
|
inline |
Returns a reference to the element at the specified position in this vector.
|
inline |
Returns a constant reference to the element at the specified position in this vector.
|
inline |
Returns a reference to last element in this vector.
|
inline |
Returns a constant reference to last element in this vector.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Returns the internal capacity (in number of elements) of this vector. This refers to the memory allocated for this vector.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Destroys all elements in this vector.
size() returns 0 but capacity() is unchanged.
|
inline |
|
inline |
|
inlinenoexcept |
Returns a constant pointer to the beginning of this vector.
|
inlinenoexcept |
Returns a pointer to the beginning of this vector.
|
inlinenoexcept |
Returns true if this vector is empty.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
Returns a reference to first element in this vector.
|
inline |
Returns a constant reference to first element in this vector.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Takes the ownership of dynamically allocated elements from the rhs vector or copies all elements if the dynamic allocation is not used yet.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Reserves memory for this vector to hold at least size elements.
| [in] | size | Specifies the minimum reserved capacity. The initial capacity is equal to the template argument LocalCapacity. If the new size is smaller than or equal to the current capacity, this function has no effect. |
capacity() returns a value that is greater than or equal to the input parameter size.
|
inline |
|
inline |
Resizes this vector to the new size and explicitly initializes all newly allocated elements.
| [in] | size | Specifies the new vector size (in number of elements). |
| [in] | value | Specifies the value all newly allocated elements will be initialized with. |
size() returns the same value as the input parameter size.
|
inline |
Resizes this vector to the new size and explicitly keeps all newly elements uninitialized.
| [in] | size | Specifies the new vector size (in number of elements). |
size() returns the same value as the input parameter size.
|
inline |
Re-allocates the internal memory for this vector to fit precisely the current number of elements.
capacity() returns the same value as size().
|
inlinenoexcept |
Returns the size (in number of elements) of this vector.
|
inline |
| size_type LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::cap_ |
| AlignedArray<T, LocalCapacity> LLGL::SmallVector< T, LocalCapacity, Allocator, GrowStrategy >::local_ |