AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
ADynamicVector< StoredType > Class Template Reference

Vector implementation for ASmallVector. More...

Detailed Description

template<typename StoredType>
class ADynamicVector< StoredType >

Vector implementation for ASmallVector.

Template Parameters
Tstored type
Note
This vector implementation is indented to use only by ASmallVector. If it's not your case, consider using AVector instead.

Public Types

using self = ADynamicVector
 
using super = ADynamicVector
 
using iterator = StoredType *
 
using const_iterator = const StoredType *
 
using reference = StoredType &
 
using const_reference = const StoredType &
 
using value = StoredType
 

Public Member Functions

constexpr ADynamicVector (const ADynamicVector &rhs)
 
constexpr ADynamicVector (ADynamicVector &&rhs) noexcept
 
constexpr StoredType * data () noexcept
 
constexpr const StoredType * data () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr iterator end () noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr StoredType & front () noexcept
 
constexpr StoredType & back () noexcept
 
constexpr const StoredType & front () const noexcept
 
constexpr const StoredType & back () const noexcept
 
constexpr void push_back (StoredType value) noexcept
 
constexpr void push_front (StoredType value) noexcept
 
constexpr void pop_back () noexcept
 
constexpr void pop_front () noexcept
 
constexpr StoredType & operator[] (std::size_t index) noexcept
 
constexpr StoredType & operator[] (std::size_t index) const noexcept
 
constexpr bool empty () const noexcept
 
constexpr void clear () noexcept
 
void deallocate ()
 
constexpr std::size_t size () const noexcept
 
constexpr std::size_t reserved () const noexcept
 
template<typename OtherIterator >
constexpr iterator insert (iterator at, OtherIterator begin, OtherIterator end)
 
constexpr iterator insert (iterator at, StoredType value)
 
constexpr iterator erase (iterator at)
 
constexpr iterator erase (iterator begin, iterator end)
 
void reserve (std::size_t newSize)
 
ADynamicVectoroperator= (ADynamicVector &&rhs) noexcept
 
template<typename OtherContainer >
iterator insertAll (const OtherContainer &c) noexcept
 
template<typename OtherContainer >
iterator insertAll (OtherContainer &&c) noexcept
 
template<typename OtherContainer >
iterator insertAll (iterator at, const OtherContainer &c) noexcept
 
template<typename OtherContainer >
iterator insertAll (iterator at, OtherContainer &&c) noexcept
 
void removeAll (const StoredType &item) noexcept
 
void removeFirst (const StoredType &item) noexcept
 
template<typename OtherContainer >
bool isSubsetOf (const OtherContainer &c) const noexcept
 
bool contains (const StoredType &value) const noexcept
 
std::size_t sizeInBytes () const noexcept
 
StoredType & at (std::size_t index)
 
const StoredType & at (std::size_t index) const
 
selfoperator<< (const StoredType &rhs) noexcept
 
selfoperator<< (StoredType &&rhs) noexcept
 
template<typename OtherContainer , std::enable_if_t<!std::is_convertible_v< OtherContainer, StoredType >, bool > = true>
selfoperator<< (const OtherContainer &c) noexcept
 
template<typename OtherContainer , std::enable_if_t<!std::is_convertible_v< OtherContainer, StoredType >, bool > = true>
selfoperator<< (OtherContainer &&c) noexcept
 
StoredType & first () noexcept
 
const StoredType & first () const noexcept
 
StoredType & last () noexcept
 
const StoredType & last () const noexcept
 
size_t indexOf (const StoredType &value) const noexcept
 
void sort () noexcept
 
template<typename Comparator >
void sort (Comparator &&comparator) noexcept
 
void removeAt (size_t index) noexcept
 
template<typename Predicate >
void removeIf (Predicate &&predicate) noexcept
 
ASet< StoredType > toSet () const noexcept
 
template<aui::invocable< const StoredType & > UnaryOperation>
auto map (UnaryOperation &&transformer) const -> AVector< decltype(transformer(std::declval< StoredType >()))>
 
template<aui::invocable< const StoredType & > UnaryOperation>
auto toMap (UnaryOperation &&transformer) const -> AMap< decltype(transformer(std::declval< StoredType >()).first), decltype(transformer(std::declval< StoredType >()).second)>
 
template<aui::invocable< StoredType & > UnaryOperation>
auto toMap (UnaryOperation &&transformer) -> AMap< decltype(transformer(std::declval< StoredType >()).first), decltype(transformer(std::declval< StoredType >()).second)>
 
template<aui::predicate< const StoredType & > Predicate>
self filter (Predicate &&predicate)
 

Static Public Member Functions

template<aui::incrementable Iterator, aui::invocable< decltype(*std::declval< Iterator >())> UnaryOperation>
static auto fromRange (aui::range< Iterator > range, UnaryOperation &&transformer) -> AVector< decltype(transformer(range.first()))>
 Constructs a new vector of transformed items of the range. More...
 

Signals and public fields

iterator mBegin = nullptr
 
iterator mEnd = nullptr
 
iterator mBufferEnd = nullptr
 

Member Function Documentation

◆ contains()

template<typename StoredType >
bool ADynamicVector< StoredType >::contains ( const StoredType &  value) const
inlinenoexcept
Returns
true if container contains an element, false otherwise.

◆ first() [1/2]

template<typename StoredType >
const StoredType & ADynamicVector< StoredType >::first ( ) const
inlinenoexcept
Sneaky assertions
Container is not empty.
Returns
the first element.

◆ first() [2/2]

template<typename StoredType >
StoredType & ADynamicVector< StoredType >::first ( )
inlinenoexcept
Sneaky assertions
Container is not empty.
Returns
the first element.

◆ fromRange()

template<typename StoredType >
template<aui::incrementable Iterator, aui::invocable< decltype(*std::declval< Iterator >())> UnaryOperation>
static auto ADynamicVector< StoredType >::fromRange ( aui::range< Iterator >  range,
UnaryOperation &&  transformer 
) -> AVector<decltype(transformer(range.first()))>
inlinestatic

Constructs a new vector of transformed items of the range.

Parameters
rangeitems to transform from.
transformertransformer function.
Returns
A new vector.

◆ indexOf()

template<typename StoredType >
size_t ADynamicVector< StoredType >::indexOf ( const StoredType &  value) const
inlinenoexcept
Parameters
valueelement to find.
Returns
index of the specified element. If element is not found, -1 is returned.

◆ insertAll() [1/4]

template<typename StoredType >
template<typename OtherContainer >
iterator ADynamicVector< StoredType >::insertAll ( const OtherContainer &  c)
inlinenoexcept

Inserts all values of the specified container to the end.

Template Parameters
OtherContainerother container type.
Parameters
cother container
Returns
iterator pointing to the first element inserted.

◆ insertAll() [2/4]

template<typename StoredType >
template<typename OtherContainer >
iterator ADynamicVector< StoredType >::insertAll ( iterator  at,
const OtherContainer &  c 
)
inlinenoexcept

Inserts all values of the specified container.

Template Parameters
OtherContainerother container type.
Parameters
atposition to insert at.
cother container
Returns
iterator pointing to the first element inserted.

◆ insertAll() [3/4]

template<typename StoredType >
template<typename OtherContainer >
iterator ADynamicVector< StoredType >::insertAll ( iterator  at,
OtherContainer &&  c 
)
inlinenoexcept

Inserts all values of the specified container.

Template Parameters
OtherContainerother container type.
Parameters
atposition to insert at.
cother container
Returns
iterator pointing to the first element inserted.

◆ insertAll() [4/4]

template<typename StoredType >
template<typename OtherContainer >
iterator ADynamicVector< StoredType >::insertAll ( OtherContainer &&  c)
inlinenoexcept

Inserts all values of the specified container to the end.

Template Parameters
OtherContainerother container type.
Parameters
cother container
Returns
iterator pointing to the first element inserted.

◆ isSubsetOf()

template<typename StoredType >
template<typename OtherContainer >
bool ADynamicVector< StoredType >::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 >
const StoredType & ADynamicVector< StoredType >::last ( ) const
inlinenoexcept
Sneaky assertions
Container is not empty.
Returns
the last element.

◆ last() [2/2]

template<typename StoredType >
StoredType & ADynamicVector< StoredType >::last ( )
inlinenoexcept
Sneaky assertions
Container is not empty.
Returns
the last element.

◆ operator<<() [1/4]

template<typename StoredType >
template<typename OtherContainer , std::enable_if_t<!std::is_convertible_v< OtherContainer, StoredType >, bool > = true>
self & ADynamicVector< StoredType >::operator<< ( const OtherContainer &  c)
inlinenoexcept

Shortcut to insertAll.

Parameters
rhscontainer to push
Returns
self

◆ operator<<() [2/4]

template<typename StoredType >
self & ADynamicVector< StoredType >::operator<< ( const StoredType &  rhs)
inlinenoexcept

Shortcut to push_back.

Parameters
rhsvalue to push
Returns
self

◆ operator<<() [3/4]

template<typename StoredType >
template<typename OtherContainer , std::enable_if_t<!std::is_convertible_v< OtherContainer, StoredType >, bool > = true>
self & ADynamicVector< StoredType >::operator<< ( OtherContainer &&  c)
inlinenoexcept

Shortcut to insertAll.

Parameters
rhscontainer to push
Returns
self

◆ operator<<() [4/4]

template<typename StoredType >
self & ADynamicVector< StoredType >::operator<< ( StoredType &&  rhs)
inlinenoexcept

Shortcut to push_back.

Parameters
rhsvalue to push
Returns
self

◆ removeAll()

template<typename StoredType >
void ADynamicVector< StoredType >::removeAll ( const StoredType &  item)
inlinenoexcept

Removes all occurrences of item.

Parameters
itemelement to remove.

◆ removeAt()

template<typename StoredType >
void ADynamicVector< StoredType >::removeAt ( size_t  index)
inlinenoexcept

Removes element at the specified index.

Sneaky assertions
index points to the existing element.
Parameters
indexindex of the element.

◆ removeFirst()

template<typename StoredType >
void ADynamicVector< StoredType >::removeFirst ( const StoredType &  item)
inlinenoexcept

Removes first occurrence of item.

Parameters
itemelement to remove.

◆ removeIf()

template<typename StoredType >
template<typename Predicate >
void ADynamicVector< StoredType >::removeIf ( Predicate &&  predicate)
inlinenoexcept

Removes element if predicate(container[i]) == true.

Parameters
predicatepredicate

#include <AUI/Common/ADynamicVector.h>


The documentation for this class was generated from the following file: