![]() |
LLGL 0.05 Beta
|
Generic container class for dynamic arrays that usually do not change in size. More...
#include <DynamicArray.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 | |
| DynamicArray ()=default | |
| Default initializes an empty array. | |
| DynamicArray (std::nullptr_t) | |
| Equivalent to default constructor: initializes an empty array. | |
| DynamicArray (const DynamicArray &other) | |
Initializes the array with a copy of all elements from the other array. | |
| DynamicArray (DynamicArray &&other) noexcept | |
Takes the ownership of dynamically allocated elements from the other array. | |
| template<typename InputIter> | |
| DynamicArray (InputIter from, InputIter to) | |
Initializes the array with the specified elements in the half-open range [from, to). | |
| DynamicArray (size_type count, UninitializeTag) | |
| Initializes the array with the specified number of elements and initial default value. | |
| DynamicArray (size_type count, const value_type &value=value_type{}) | |
| Initializes the array with the specified number of elements and initial value. | |
| ~DynamicArray () | |
| Destroys all elements in this array. | |
| bool | empty () const noexcept |
| Returns true if this array is empty. | |
| size_type | size () const noexcept |
| Returns the size (in number of elements) of this array. | |
| size_type | capacity () const noexcept |
Convenience function to be partially compatible with std::vector<T>. Equivalent to size(). | |
| pointer | data () noexcept |
| Returns a pointer to the beginning of this array. | |
| const_pointer | data () const noexcept |
| Returns a constant pointer to the beginning of this array. | |
| pointer | get () noexcept |
Convenience function to be partially compatible with std::unique_ptr<T[]>. Equivalent to data(). | |
| const_pointer | get () const noexcept |
Convenience function to be partially compatible with std::unique_ptr<T[]>. Equivalent to data(). | |
| reference | at (size_type pos) |
| Returns a reference to the element at the specified position in this array. | |
| const_reference | at (size_type pos) const |
| Returns a constant reference to the element at the specified position in this array. | |
| reference | front () |
| Returns a reference to first element in this array. | |
| const_reference | front () const |
| Returns a constant reference to first element in this array. | |
| reference | back () |
| Returns a reference to last element in this array. | |
| const_reference | back () const |
| Returns a constant reference to last element in this array. | |
| void | clear () |
| Release the internal memory. | |
| pointer | release () |
| Release the ownership of the internally allocated memory. | |
| void | resize (size_type newSize, UninitializeTag) |
| Resizes this array to the new size if the new size is larger than the old size. This will also leave all new elements uninitialized. | |
| void | resize (size_type newSize, const value_type &value) |
| Resizes this array to the new size if the new size is larger than the old size and explicitly initializes all newly allocated elements. | |
| void | swap (DynamicArray &other) noexcept |
| 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 |
| DynamicArray & | operator= (const DynamicArray &rhs) |
| DynamicArray & | operator= (DynamicArray &&rhs) noexcept(std::is_nothrow_destructible< T >::value) |
| const_reference | operator[] (size_type pos) const |
| reference | operator[] (size_type pos) |
| operator ArrayView< T > () const | |
| operator bool () const | |
| Returns true if this array is non-empty. | |
Generic container class for dynamic arrays that usually do not change in size.
push_back, pop_back, or insert functionality, it only supports trivially constructible and trivially copyable types. | T | Specifies the array element type. |
| Allocator | Specifies the memory allocator. This has to be compatible with std::allocator. By default std::allocator<T>. |
| using LLGL::DynamicArray< T, Allocator >::const_iterator = const value_type* |
| using LLGL::DynamicArray< T, Allocator >::const_pointer = const value_type* |
| using LLGL::DynamicArray< T, Allocator >::const_reference = const value_type& |
| using LLGL::DynamicArray< T, Allocator >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
| using LLGL::DynamicArray< T, Allocator >::difference_type = std::ptrdiff_t |
| using LLGL::DynamicArray< T, Allocator >::iterator = value_type* |
| using LLGL::DynamicArray< T, Allocator >::pointer = value_type* |
| using LLGL::DynamicArray< T, Allocator >::reference = value_type& |
| using LLGL::DynamicArray< T, Allocator >::reverse_iterator = std::reverse_iterator<iterator> |
| using LLGL::DynamicArray< T, Allocator >::size_type = std::size_t |
| using LLGL::DynamicArray< T, Allocator >::value_type = T |
|
default |
Default initializes an empty array.
|
inline |
Equivalent to default constructor: initializes an empty array.
|
inline |
Initializes the array with a copy of all elements from the other array.
|
inlinenoexcept |
Takes the ownership of dynamically allocated elements from the other array.
|
inline |
Initializes the array with the specified elements in the half-open range [from, to).
|
inlineexplicit |
Initializes the array with the specified number of elements and initial default value.
|
inlineexplicit |
Initializes the array with the specified number of elements and initial value.
|
inline |
Destroys all elements in this array.
|
inline |
Returns a reference to the element at the specified position in this array.
|
inline |
Returns a constant reference to the element at the specified position in this array.
|
inline |
Returns a reference to last element in this array.
|
inline |
Returns a constant reference to last element in this array.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Convenience function to be partially compatible with std::vector<T>. Equivalent to size().
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Release the internal memory.
size() and capacity() return 0.
|
inline |
|
inline |
|
inlinenoexcept |
Returns a constant pointer to the beginning of this array.
|
inlinenoexcept |
Returns a pointer to the beginning of this array.
|
inlinenoexcept |
Returns true if this array is empty.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Returns a reference to first element in this array.
|
inline |
Returns a constant reference to first element in this array.
|
inlinenoexcept |
Convenience function to be partially compatible with std::unique_ptr<T[]>. Equivalent to data().
|
inlinenoexcept |
Convenience function to be partially compatible with std::unique_ptr<T[]>. Equivalent to data().
|
inline |
|
inline |
Returns true if this array is non-empty.
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Release the ownership of the internally allocated memory.
|
inline |
|
inline |
|
inline |
Resizes this array to the new size if the new size is larger than the old size and explicitly initializes all newly allocated elements.
| [in] | newSize | Specifies the new array 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 array to the new size if the new size is larger than the old size. This will also leave all new elements uninitialized.
| [in] | newSize | Specifies the new array size (in number of elements). |
size() returns the same value as the input parameter size.
|
inlinenoexcept |
Returns the size (in number of elements) of this array.
|
inlinenoexcept |