|
| Array ()=default |
|
| Array (const TCounter elementCnt, const TCounter allocatedSize=maxValue) |
| Constructs array of given size. More...
|
|
| Array (std::initializer_list< StorageType > list) |
| Constructs array from initialized list. More...
|
|
| Array (Array &&other) |
| Move constructor from array of the same type. More...
|
|
| ~Array () |
|
Array & | operator= (Array &&other) |
|
Array & | operator= (const CopyableArray< T, TAllocator, TCounter > &other) |
| Performs deep-copy of array elements, resizing array if needed. More...
|
|
template<typename U , typename = std::enable_if_t<std::is_lvalue_reference<T>::value, U>> |
Array & | operator= (Array< U > &&other) |
| For l-value references assign each value (does not actually move anything). More...
|
|
Array | clone () const |
| Performs a deep copy of all elements of the array. More...
|
|
INLINE T & | operator[] (const TCounter idx) noexcept |
|
INLINE const T & | operator[] (const TCounter idx) const noexcept |
|
INLINE T & | front () noexcept |
|
INLINE const T & | front () const noexcept |
|
INLINE T & | back () noexcept |
|
INLINE const T & | back () const noexcept |
|
void | fill (const T &t) |
| Sets all elements of the array to given value. More...
|
|
INLINE TCounter | size () const noexcept |
|
INLINE TCounter | capacity () const noexcept |
|
INLINE bool | empty () const noexcept |
|
void | resize (const TCounter newSize) |
| Resizes the array to new size. More...
|
|
void | resizeAndSet (const TCounter newSize, const T &value) |
| Resizes the array to new size and assigns a given value to all newly created elements. More...
|
|
void | reserve (const TCounter newMaxSize) |
| Allocates enough memory to store the given number of elements. More...
|
|
void | shrink () |
| Reallocates the array, removing the unused elements to save memory. More...
|
|
template<typename U > |
INLINE void | push (U &&u) |
| Adds new element to the end of the array, resizing the array if necessary. More...
|
|
template<typename TIter > |
void | pushAll (const TIter first, const TIter last) |
|
void | pushAll (const Array &other) |
|
void | pushAll (Array &&other) |
|
template<typename... TArgs> |
StorageType & | emplaceBack (TArgs &&... args) |
| Constructs a new element at the end of the array in place, using the provided arguments. More...
|
|
template<typename U > |
void | insert (const TCounter position, U &&value) |
| Inserts a new element to given position in the array. More...
|
|
template<typename TIterator > |
void | insert (const TCounter position, const TIterator first, const TIterator last) |
| Inserts a range of values into the array, starting at given position. More...
|
|
INLINE T | pop () |
| Removes the last element from the array and return its value. More...
|
|
void | remove (const TCounter idx) |
| Removes an element with given index from the array. More...
|
|
void | remove (const ArrayView< const TCounter > idxs) |
| Removes elements specified by indices from the array. More...
|
|
template<typename TIter > |
void | remove (TIter first, TIter last) |
| Removes all elements in given range. More...
|
|
void | clear () |
| Removes all elements from the array, but does NOT release the memory. More...
|
|
void | swap (Array &other) |
| Swaps content of two arrays. More...
|
|
INLINE Iterator< StorageType > | begin () noexcept |
|
INLINE Iterator< const StorageType > | begin () const noexcept |
|
INLINE Iterator< const StorageType > | cbegin () const noexcept |
|
INLINE Iterator< StorageType > | end () noexcept |
|
INLINE Iterator< const StorageType > | end () const noexcept |
|
INLINE Iterator< const StorageType > | cend () const noexcept |
|
const TAllocator & | allocator () const |
| Returns the interface to the allocator. More...
|
|
TAllocator & | allocator () |
| Returns the interface to the allocator. More...
|
|
INLINE | operator ArrayView< T, TCounter > () noexcept |
| Implicit conversion to arrayview. More...
|
|
INLINE | operator ArrayView< const T, TCounter > () const noexcept |
| Implicit conversion to arrayview, const version. More...
|
|
ArrayView< T, TCounter > | view () noexcept |
| Explicit conversion to arrayview. More...
|
|
ArrayView< const T, TCounter > | view () const noexcept |
| Explicit conversion to arrayview, const version. More...
|
|
bool | operator== (const Array &other) const noexcept |
| Comparison operator, comparings array element-by-element. More...
|
|
bool | operator!= (const Array &other) const noexcept |
| Inequality operator. More...
|
|
| Noncopyable ()=default |
|
| Noncopyable (const Noncopyable &)=delete |
|
| Noncopyable (Noncopyable &&)=default |
|
Noncopyable & | operator= (const Noncopyable &)=delete |
|
Noncopyable & | operator= (Noncopyable &&)=default |
|
template<typename T, typename TAllocator = Mallocator, typename TCounter = Size>
class Array< T, TAllocator, TCounter >
Generic dynamically allocated resizable storage.
Can also be used with STL algorithms.
Definition at line 43 of file Array.h.
template<typename T , typename TAllocator = Mallocator, typename TCounter = Size>
void Array< T, TAllocator, TCounter >::resize |
( |
const TCounter |
newSize | ) |
|
|
inline |
Resizes the array to new size.
This potentially allocated more memory than required, to speed up the allocations. If the new size is bigger than the current size, new elements are created using default constructor, all currently stored values (within interval [0, newSize-1]) are preserved, possibly moved using their move constructor. If the new size is lower than the current size, elements at the end of the array are destroyed. However, the array is not reallocated, the size is kept for future growth.
- Attention
- This invalidates all references, pointers, iterators, array views, etc. pointed to the elements of the array.
Definition at line 215 of file Array.h.