The TLimitedArray class provides a simple dynamic array or vector class for ULIS interfaces, with a maximum capacity or limit.
More...
|
| TLimitedArray () |
|
| TLimitedArray (const TLimitedArray< T, _LIMIT > &iOther)=delete |
|
| TLimitedArray (TLimitedArray< T, _LIMIT > &&iOther) noexcept |
|
| TLimitedArray (uint64 iSize) |
|
| ~TLimitedArray () |
|
T & | At (uint64 iIndex) |
|
const T & | At (uint64 iIndex) const |
|
T & | Back () |
|
const T & | Back () const |
|
uint8 * | Bits () |
|
const uint8 * | Bits () const |
|
uint64 | Capacity () const |
|
void | Clear () |
|
T * | Data () |
|
const T * | Data () const |
|
template<class ... Args> |
void | Emplace (uint64 iPos, Args &&... args) |
|
template<class ... Args> |
void | EmplaceBack (Args &&... args) |
|
void | Erase (const T &iElement) |
|
void | Erase (uint64 iPos, uint64 iCount=1) |
|
T & | Front () |
|
const T & | Front () const |
|
void | Insert (uint64 iPos, const T &iValue) |
|
void | Insert (uint64 iPos, T &&iValue) |
|
void | Insert (uint64 iPos, uint64 iCount, const T &iValue) |
|
bool | IsEmpty () const |
|
uint64 | Limit () const |
|
TLimitedArray< T, _LIMIT > & | operator= (const TLimitedArray< T, _LIMIT > &iOther)=delete |
|
TLimitedArray< T, _LIMIT > & | operator= (TLimitedArray< T, _LIMIT > &&iOther)=delete |
|
T & | operator[] (uint64 iIndex) |
|
const T & | operator[] (uint64 iIndex) const |
|
void | PopBack () |
|
void | PushBack (const T &iValue=T()) |
|
void | PushBack (T &&iValue) |
|
void | Reserve (uint64 iCapacity) |
|
void | Resize (uint64 iSize) |
|
void | Shrink () |
|
uint64 | Size () const |
|
template<typename T, uint64 _LIMIT>
class TLimitedArray< T, _LIMIT >
The need of a custom TLimitedArray class rose from the fact that std:: classes cannot be exported easily accross dll boundaries when ULIS is compiled as a shared library.
◆ ~TLimitedArray()
template<typename T , uint64 _LIMIT>
Destroy the Array and cleanup memory.
◆ TLimitedArray() [1/4]
template<typename T , uint64 _LIMIT>
Default constructor with size 0, capicity 0, uninitialized.
◆ TLimitedArray() [2/4]
template<typename T , uint64 _LIMIT>
Constructor with known size, both capacity and size will match the requested size. The array will have a size of iSize and the elements are default constructed.
◆ TLimitedArray() [3/4]
template<typename T , uint64 _LIMIT>
Copy constructor, explicitly removed.
◆ TLimitedArray() [4/4]
template<typename T , uint64 _LIMIT>
Move constructor. The first object is left in a valid but empty state. The second object steals the buffer and the state ( size and capacity ).
◆ At() [1/2]
template<typename T , uint64 _LIMIT>
◆ At() [2/2]
template<typename T , uint64 _LIMIT>
Access component at index. Alias of operator[]()
- See also
- operator[]() const
◆ Back() [1/2]
template<typename T , uint64 _LIMIT>
Access component at back. The behaviour is undefined if the array is empty.
◆ Back() [2/2]
template<typename T , uint64 _LIMIT>
Access const component at back. The behaviour is undefined if the array is empty.
◆ Bits() [1/2]
template<typename T , uint64 _LIMIT>
◆ Bits() [2/2]
template<typename T , uint64 _LIMIT>
Returns the const raw bits.
◆ Capacity()
template<typename T , uint64 _LIMIT>
Returns the array capacity.
◆ Clear()
template<typename T , uint64 _LIMIT>
Clear the array, deallocating everything.
◆ Data() [1/2]
template<typename T , uint64 _LIMIT>
◆ Data() [2/2]
template<typename T , uint64 _LIMIT>
Returns the const storage.
◆ Emplace()
template<typename T , uint64 _LIMIT>
template<class ... Args>
Emplace, emplace a new element at pos in the buffer, possibly reallocating the underlying storage if the capacity has been reached.
◆ EmplaceBack()
template<typename T , uint64 _LIMIT>
template<class ... Args>
EmplaceBack, emplace a new element at the end of the buffer, possibly reallocating the underlying storage if the capacity has been reached.
◆ Erase() [1/2]
template<typename T , uint64 _LIMIT>
Erase first found element, if found in the array. Behaviour is undefined if the array is empty. Does nothing if such element is not in the array.
◆ Erase() [2/2]
template<typename T , uint64 _LIMIT>
Erase elements at pos in the array. Behaviour is undefined if the array is empty.
◆ Front() [1/2]
template<typename T , uint64 _LIMIT>
Access component at front. The behaviour is undefined if the array is empty.
◆ Front() [2/2]
template<typename T , uint64 _LIMIT>
Access const component at front. The behaviour is undefined if the array is empty.
◆ Insert() [1/3]
template<typename T , uint64 _LIMIT>
Insert, insert a new element at pos in the buffer, possibly reallocating the underlying storage if the capacity has been reached.
◆ Insert() [2/3]
template<typename T , uint64 _LIMIT>
Insert, insert a new element at pos in the buffer, possibly reallocating the underlying storage if the capacity has been reached.
◆ Insert() [3/3]
template<typename T , uint64 _LIMIT>
Insert, insert count new elements at pos in the buffer, possibly reallocating the underlying storage if the capacity has been reached.
◆ IsEmpty()
template<typename T , uint64 _LIMIT>
Returns wether the array is empty or not.
◆ Limit()
template<typename T , uint64 _LIMIT>
◆ operator=() [1/2]
template<typename T , uint64 _LIMIT>
Copy Assignment Operator, explicitly removed.
◆ operator=() [2/2]
template<typename T , uint64 _LIMIT>
Move Assignment Operator, explicitly removed.
◆ operator[]() [1/2]
template<typename T , uint64 _LIMIT>
Access component at index. The behaviour is undefined if the array has no size. The behaviour is undefined if the index is greater than the size. The behaviour is undefined if the underlying buffer is nullptr, which indicates a corrupted states anyway.
◆ operator[]() [2/2]
template<typename T , uint64 _LIMIT>
Access const component at index. The behaviour is undefined if the array has no size. The behaviour is undefined if the index is greater than the size. The behaviour is undefined if the underlying buffer is nullptr, which indicates a corrupted states anyway.
◆ PopBack()
template<typename T , uint64 _LIMIT>
PopBack, remove last element. Behaviour is undefined if the array is empty.
◆ PushBack() [1/2]
template<typename T , uint64 _LIMIT>
void TLimitedArray< T, _LIMIT >::PushBack |
( |
const T & |
iValue = T() | ) |
|
|
inline |
PushBack, insert a new element at the end of the buffer, possibly reallocating the underlying storage if the capacity has been reached.
◆ PushBack() [2/2]
template<typename T , uint64 _LIMIT>
PushBack, insert a new element at the end of the buffer, possibly reallocating the underlying storage if the capacity has been reached.
◆ Reserve()
template<typename T , uint64 _LIMIT>
Reserve some capacity for future usage, if iCapacity is bigger than the current capacity.
If iCapacity is lower or equal to capacity, this function does nothing.
This function might invalid existing pointers to the underlying buffer.
The size doesn't change.
◆ Resize()
template<typename T , uint64 _LIMIT>
Resize the actual usage size of the container. This function might invalid the underlying buffer when requesting a bigger size. It has no effect if the requested size is the same as the current size.
◆ Shrink()
template<typename T , uint64 _LIMIT>
Shrink the capacity to fit the size. If the capacity is already the same as the size, the function does nothing. This function might invalid the underlying buffer. The size doesn't change.
◆ Size()
template<typename T , uint64 _LIMIT>