Vector-like container up to maxSize elements inplace.
More...
#include <AUI/Common/AStaticVector.h>
template<typename StoredType, std::size_t MaxSize>
class AStaticVector< StoredType, MaxSize >
- Template Parameters
-
T | stored type |
maxSize | maximum vector size |
Vector-like container optimized for the case when it contains up to maxSize in place, avoiding dynamic allocation. AStaticVector could not contain more than maxSize elements.
> All members, including inherited
◆ contains()
template<typename StoredType, std::size_t MaxSize>
bool AStaticVector< StoredType, MaxSize >::contains |
( |
const StoredType & | value | ) |
const |
|
inlinenoexcept |
- Returns
- true if container contains an element, false otherwise.
◆ first() [1/2]
template<typename StoredType, std::size_t MaxSize>
const StoredType & AStaticVector< StoredType, MaxSize >::first |
( |
| ) |
const |
|
inlinenoexcept |
- Sneaky assertions
- Container is not empty.
- Returns
- the first element.
◆ first() [2/2]
template<typename StoredType, std::size_t MaxSize>
- Sneaky assertions
- Container is not empty.
- Returns
- the first element.
◆ fromRange()
template<typename StoredType, std::size_t MaxSize>
static auto AStaticVector< StoredType, MaxSize >::fromRange |
( |
aui::range< Iterator > | range, |
|
|
UnaryOperation && | transformer ) -> AVector<decltype(transformer(range.first()))> |
|
inlinestatic |
- Parameters
-
range | items to transform from. |
transformer | transformer function. |
- Returns
- A new vector.
◆ indexOf()
template<typename StoredType, std::size_t MaxSize>
- Parameters
-
- Returns
- index of the specified element. If element is not found, std::nullopt is returned.
◆ insertAll() [1/4]
template<typename StoredType, std::size_t MaxSize>
template<typename OtherContainer>
iterator AStaticVector< StoredType, MaxSize >::insertAll |
( |
const OtherContainer & | c | ) |
|
|
inlinenoexcept |
Inserts all values of the specified container to the end.
- Template Parameters
-
OtherContainer | other container type. |
- Parameters
-
- Returns
- iterator pointing to the first element inserted.
◆ insertAll() [2/4]
template<typename StoredType, std::size_t MaxSize>
template<typename OtherContainer>
iterator AStaticVector< StoredType, MaxSize >::insertAll |
( |
iterator | at, |
|
|
const OtherContainer & | c ) |
|
inlinenoexcept |
Inserts all values of the specified container.
- Template Parameters
-
OtherContainer | other container type. |
- Parameters
-
at | position to insert at. |
c | other container |
- Returns
- iterator pointing to the first element inserted.
◆ insertAll() [3/4]
template<typename StoredType, std::size_t MaxSize>
template<typename OtherContainer>
iterator AStaticVector< StoredType, MaxSize >::insertAll |
( |
iterator | at, |
|
|
OtherContainer && | c ) |
|
inlinenoexcept |
Inserts all values of the specified container.
- Template Parameters
-
OtherContainer | other container type. |
- Parameters
-
at | position to insert at. |
c | other container |
- Returns
- iterator pointing to the first element inserted.
◆ insertAll() [4/4]
template<typename StoredType, std::size_t MaxSize>
template<typename OtherContainer>
iterator AStaticVector< StoredType, MaxSize >::insertAll |
( |
OtherContainer && | c | ) |
|
|
inlinenoexcept |
Inserts all values of the specified container to the end.
- Template Parameters
-
OtherContainer | other container type. |
- Parameters
-
- Returns
- iterator pointing to the first element inserted.
◆ isSubsetOf()
template<typename StoredType, std::size_t MaxSize>
template<typename OtherContainer>
bool AStaticVector< StoredType, MaxSize >::isSubsetOf |
( |
const OtherContainer & | c | ) |
const |
|
inlinenoexcept |
- Returns
- true if
c
container is a subset of this container, false otherwise.
◆ last() [1/2]
template<typename StoredType, std::size_t MaxSize>
const StoredType & AStaticVector< StoredType, MaxSize >::last |
( |
| ) |
const |
|
inlinenoexcept |
- Sneaky assertions
- Container is not empty.
- Returns
- the last element.
◆ last() [2/2]
template<typename StoredType, std::size_t MaxSize>
- Sneaky assertions
- Container is not empty.
- Returns
- the last element.
◆ operator<<() [1/4]
template<typename StoredType, std::size_t MaxSize>
template<typename OtherContainer, std::enable_if_t<!std::is_convertible_v< OtherContainer, StoredType >, bool > = true>
Shortcut to insertAll
.
- Parameters
-
- Returns
- self
◆ operator<<() [2/4]
template<typename StoredType, std::size_t MaxSize>
Shortcut to push_back
.
- Parameters
-
- Returns
- self
◆ operator<<() [3/4]
template<typename StoredType, std::size_t MaxSize>
template<typename OtherContainer, std::enable_if_t<!std::is_convertible_v< OtherContainer, StoredType >, bool > = true>
Shortcut to insertAll
.
- Parameters
-
- Returns
- self
◆ operator<<() [4/4]
template<typename StoredType, std::size_t MaxSize>
Shortcut to push_back
.
- Parameters
-
- Returns
- self
◆ removeAll()
template<typename StoredType, std::size_t MaxSize>
void AStaticVector< StoredType, MaxSize >::removeAll |
( |
const StoredType & | item | ) |
|
|
inlinenoexcept |
Removes all occurrences of item
.
- Parameters
-
◆ removeAt()
template<typename StoredType, std::size_t MaxSize>
void AStaticVector< StoredType, MaxSize >::removeAt |
( |
size_t | index | ) |
|
|
inlinenoexcept |
Removes element at the specified index.
- Sneaky assertions
index
points to the existing element.
- Parameters
-
index | index of the element. |
◆ removeFirst()
template<typename StoredType, std::size_t MaxSize>
void AStaticVector< StoredType, MaxSize >::removeFirst |
( |
const StoredType & | item | ) |
|
|
inlinenoexcept |
Removes first occurrence of item
.
- Parameters
-
◆ removeIf()
template<typename StoredType, std::size_t MaxSize>
template<typename Predicate>
void AStaticVector< StoredType, MaxSize >::removeIf |
( |
Predicate && | predicate | ) |
|
|
inlinenoexcept |
Removes element if predicate(container[i]) == true.
- Parameters
-