VCTR
Loading...
Searching...
No Matches
vctr::Vector< ElementType, Allocator > Class Template Reference

The heap-allocated container type. More...

Inheritance diagram for vctr::Vector< ElementType, Allocator >:
vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType > vctr::Config vctr::StorageInfo< StorageType >

Public Types

using value_type = typename Vctr::value_type
 

Public Member Functions

constexpr Vector ()=default
 Creates an empty Vector with size = 0.
 
template<std::convertible_to< Allocator< ElementType > > Alloc>
 Vector (Alloc &&allocator)
 Creates an empty Vector that uses the specified allocator instance.
 
constexpr Vector (size_t size)
 Creates an uninitialised Vector of the desired size.
 
constexpr Vector (size_t size, ElementType initialValue)
 Creates a Vector with all elements initialised to initialValue of the desired size.
 
constexpr Vector (std::initializer_list< ElementType > il)
 Creates a Vector from an initializer list.
 
template<is::suitableInitializerForElementType< ElementType > First, std::same_as< First >... Other>
requires (sizeof...(Other) > 0) && (! std::convertible_to<First, size_t>)
constexpr Vector (First &&first, Other &&... other)
 Creates a Vector by moving a pack of elements into it.
 
constexpr Vector (const Vector &other)
 Creates a copy of the other Vector.
 
constexpr Vector (Vector &&other)
 Moves the other Vector into this one.
 
template<is::triviallyCopyableWithDataAndSize OtherContainer>
requires (! std::same_as<Vector, OtherContainer>)
constexpr Vector (const OtherContainer &other)
 This constructor will create a Vector instance of the same size as OtherContainer and will copy its values into this Vector.
 
template<is::iteratorCopyable OtherContainer>
constexpr Vector (const OtherContainer &other)
 This constructor will create a Vector instance of the same size as OtherContainer and will copy its values into this Vector.
 
constexpr Vector (const ElementType *data, size_t size)
 Copies size elements from the memory location pointed to by data.
 
template<is::inputIteratorToConstructValuesOfType< ElementType > Iterator, std::sentinel_for< Iterator > Sentinel>
constexpr Vector (Iterator first, Sentinel last)
 Creates an Vector from an iterator and a sentinel by initialising the Vector with the content read from the iterator.
 
template<is::suitableInitializerFunctionForElementType< ElementType > Fn>
constexpr Vector (size_t size, Fn &&initializerFunction)
 Creates a Vector of the given size and initialises all elements by calling initializerFunction with the element's index.
 
template<is::expression Expression>
constexpr Vector (Expression &&e)
 Creates a Vector from an expression.
 
template<has::sizeAndDataWithElementType< ElementType > Container>
constexpr Vectoroperator= (Container &&containerToCopyDataFrom)
 Copies or moves the data of the source container to this Vector.
 
constexpr Vectoroperator= (const Vector &other)
 Copy assignment operator.
 
constexpr Vectoroperator= (std::initializer_list< ElementType > elementsToAssign)
 Assigns elements from the intializer list to this Vector.
 
template<is::expression E>
constexpr void operator= (const E &expression)
 Assigns the result of an expression to this Vector.
 
constexpr StdVectorType & getUnderlyingVector ()
 Returns a reference to the underlying storage.
 
constexpr const StdVectorType & getUnderlyingVector () const
 Returns a reference to the underlying storage.
 
constexpr StdVectorType && moveUnderlyingVector () &&
 Moves the underlying storage out of this wrapper class.
 
constexpr operator StdVectorType & ()
 Conversion operator shortcut to getUnderlyingVector.
 
constexpr operator const StdVectorType & () const
 Conversion operator shortcut to getUnderlyingVector.
 
template<class OtherAllocator >
requires isDifferentAllocatorTypeWithSameValueType<OtherAllocator>
 operator std::vector< ElementType, OtherAllocator > () const
 Conversion operator that allows us to assign this Vector to a std::vector with different allocator type.
 
constexpr void resize (size_t i)
 Changes the size of this Vector, potentially allocating memory.
 
constexpr void reserve (size_t i)
 Pre-allocates memory for the given number of elements.
 
constexpr void shrink_to_fit ()
 Adjusts the allocated memory to the actual number of elements.
 
constexpr void init (size_t newSize, const value_type &value)
 Resizes this vector to newSize and fills it with the given value.
 
template<is::suitableInitializerFunctionForElementType< ElementType > Fn>
constexpr void init (size_t newSize, Fn &&initializerFunction)
 Resizes this vector to newSize and fills it via the given initializerFunction.
 
constexpr void clear () noexcept
 Erase all elements from the Vector.
 
constexpr Allocator< ElementType > get_allocator () const noexcept
 Returns the allocator associated with the Vector.
 
constexpr size_t capacity () const noexcept
 Returns the number of elements the Vector can currently hold without re-allocation.
 
constexpr size_t max_size () const noexcept
 Returns the maximum number of elements the container is able to hold.
 
constexpr auto erase (ConstIterator elementToErase)
 Erases the element referenced by elementToErase and returns the iterator to the element behind it.
 
constexpr auto erase (size_t idx)
 Erases the element at index idx and returns the iterator to the element behind it.
 
constexpr auto erase (ConstIterator first, ConstIterator last)
 Erases the range of elements referenced by it and returns the iterator to the element behind it.
 
constexpr auto erase (size_t startIdx, size_t numElements)
 Erases numElements elements starting from index startIdx and returns the iterator to the element behind it.
 
template<std::equality_comparable_with< ElementType > T>
constexpr auto eraseFirstOccurrenceOf (const T &value)
 Erases the first occurrence of value from this Vector and adjusts its size.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto eraseFirstOccurrenceIf (Fn &&predicate)
 Erases the first occurrence for which predicate is true from this Vector and adjusts its size.
 
template<std::equality_comparable_with< ElementType > T>
constexpr bool eraseAllOccurrencesOf (const T &value)
 Removes all occurrences of value from this Vector and adjusts its size.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr bool eraseAllOccurrencesIf (Fn &&predicate)
 Removes all elements inside this Vector for which predicate is true and adjusts its size.
 
constexpr ElementType & push_back (ElementType &&newElement)
 Adds an element to the end of the Vector.
 
constexpr ElementType & push_back (const ElementType &newElement)
 Adds an element to the end of the Vector.
 
constexpr ElementType pop_back ()
 Removes the last element in the vector, effectively reducing the container size by one.
 
template<class... Args>
constexpr void emplace_back (Args &&... args)
 Constructs an element in-place at the end of the Vector.
 
constexpr void swap (Vector &other) noexcept
 Swaps the underlying memory with the other Vector.
 
template<is::anyVctr VctrToAppend>
void append (VctrToAppend &&vctrToAppend, bool moveValuesFromSrc=false)
 Appends a Span, Array or Vector to the end of this Vector, optionally by moving elements from the source.
 
auto insert (ConstIterator pos, const ElementType &value)
 Inserts value before the element referenced by pos and returns an iterator to the inserted value.
 
auto insert (size_t idx, const ElementType &value)
 Inserts value at index idx and returns an iterator to the inserted value.
 
auto insert (ConstIterator pos, ElementType &&value)
 Inserts value before the element referenced by pos and returns an iterator to the inserted value.
 
auto insert (size_t idx, ElementType &&value)
 Inserts value at index idx and returns an iterator to the inserted value.
 
auto insert (ConstIterator pos, size_t numCopies, const ElementType &value)
 Inserts numCopies copies of value before the element referenced by pos and returns an iterator to the inserted values.
 
auto insert (size_t idx, size_t numCopies, const ElementType &value)
 Inserts numCopies copies of value at index idx and returns an iterator to the inserted values.
 
template<is::inputIteratorToConstructValuesOfType< ElementType > InputIterator>
auto insert (ConstIterator pos, InputIterator first, InputIterator last)
 Inserts a range of values before the element referenced by pos and returns an iterator to the inserted values.
 
template<is::inputIteratorToConstructValuesOfType< ElementType > InputIterator>
auto insert (size_t idx, InputIterator first, InputIterator last)
 Inserts a range of values at index idx and returns an iterator to the inserted values.
 
auto insert (ConstIterator pos, std::initializer_list< ElementType > initList)
 Inserts a list of values before the element referenced by pos and returns an iterator to the first inserted value.
 
auto insert (size_t idx, std::initializer_list< ElementType > initList)
 Inserts a list of values at index idx and returns an iterator to the first inserted value.
 
template<is::anyVctr VctrToInsert>
auto insert (ConstIterator pos, VctrToInsert &&vctrToInsert, bool moveValuesFromSrc=false)
 Inserts a VCTR container before the element referenced by pos and returns an iterator to the first inserted value.
 
template<is::anyVctr VctrToInsert>
auto insert (size_t idx, VctrToInsert &&vctrToInsert, bool moveValuesFromSrc=false)
 Inserts a VCTR container at index idx and returns an iterator to the first inserted value.
 
constexpr size_t size () const noexcept
 Returns the number of elements.
 
constexpr bool empty () const noexcept
 Checks whether the container is empty.
 
constexpr size_t sizeInBytes () const noexcept
 Returns the container size in bytes.
 
constexpr size_t backIdx () const noexcept
 Returns the index referring to the last element in the vector.
 
constexpr auto & operator[] (size_t i)
 Returns a reference to element i.
 
constexpr auto & operator[] (size_t i) const
 Returns a reference to element i.
 
constexpr auto & at (size_t i)
 Returns a reference to element i.
 
constexpr auto & at (size_t i) const
 Returns a reference to element i.
 
constexpr auto && front ()
 Returns a reference to the first element.
 
constexpr auto && front () const
 Returns a reference to the first element.
 
constexpr auto && back ()
 Returns a reference to the last element.
 
constexpr auto && back () const
 Returns a reference to the last element.
 
VCTR_FORCEDINLINE constexpr auto * data ()
 Returns a raw pointer to the underlying storage.
 
VCTR_FORCEDINLINE constexpr auto * data () const
 Returns a raw pointer to the underlying storage.
 
constexpr auto begin ()
 Returns an iterator to the begin of the storage.
 
constexpr auto begin () const
 Returns a const iterator to the begin of the storage.
 
constexpr auto end ()
 Returns an iterator to the first element behind the storage.
 
constexpr auto end () const
 Returns a const iterator to the first element behind the storage.
 
constexpr auto rbegin ()
 Returns a reverse iterator to the last element in the storage.
 
constexpr auto rbegin () const
 Returns a const reverse iterator to the last element in the storage.
 
constexpr auto rend ()
 Returns a reverse iterator to the element before the first element in the storage.
 
constexpr auto rend () const
 Returns a const reverse iterator to the element before the first element in the storage.
 
template<size_t startIdx>
constexpr auto subSpan ()
 Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.
 
template<size_t startIdx>
constexpr auto subSpan () const
 Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.
 
constexpr auto subSpan (size_t startIdx)
 Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.
 
constexpr auto subSpan (size_t startIdx) const
 Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.
 
template<size_t startIdx, size_t numElements>
constexpr auto subSpan ()
 Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.
 
template<size_t startIdx, size_t numElements>
constexpr auto subSpan () const
 Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.
 
constexpr auto subSpan (size_t startIdx, size_t numElements)
 Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.
 
constexpr auto subSpan (size_t startIdx, size_t numElements) const
 Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.
 
constexpr void assign (std::initializer_list< ElementType > elements)
 Assigns elements from the initializer list to this instance.
 
constexpr void copyFrom (const ElementType *otherData, size_t otherSize)
 Copies the content from otherData to this instance.
 
constexpr void fill (const value_type &value)
 Fills the container with the given value.
 
constexpr void fillLinspace (ElementType start, ElementType stop, bool includeEnd=true)
 Fills the vector with evenly spaced numbers between start and stop.
 
template<is::functionWithSignatureOrImplicitlyConvertible< void(value_type &)> Fn>
constexpr void forEach (Fn &&fn)
 Calls a function on each element.
 
template<is::functionWithSignatureOrImplicitlyConvertible< void(const value_type &)> Fn>
constexpr void forEach (Fn &&fn) const
 Calls a function on each element.
 
template<is::functionWithSignatureOrImplicitlyConvertible< value_type(const value_type &)> Fn>
constexpr void forEach (Fn &&fn)
 Calls a function on each element.
 
template<is::functionWithSignatureOrImplicitlyConvertible< void(value_type &, size_t)> Fn>
constexpr void forEach (Fn &&fn)
 Calls a function on each element and passes the element index as second function argument.
 
template<is::functionWithSignatureOrImplicitlyConvertible< void(const value_type &, size_t)> Fn>
constexpr void forEach (Fn &&fn) const
 Calls a function on each element and passes the element index as second function argument.
 
template<is::functionWithSignatureOrImplicitlyConvertible< value_type(const value_type &, size_t)> Fn>
constexpr void forEach (Fn &&fn)
 Calls a function on each element and passes the element index as second function argument.
 
template<class... Args, is::functionWithSignatureOrImplicitlyConvertible< void(value_type &, Args &&...)> Fn>
constexpr void forEach (Fn &&fn, Args &&... fnArgs)
 Calls a function on each element and forwards fnArgs to the function after the value.
 
template<class... Args, is::functionWithSignatureOrImplicitlyConvertible< void(const value_type &, Args &&...)> Fn>
constexpr void forEach (Fn &&fn, Args &&... fnArgs) const
 Calls a function on each element and forwards fnArgs to the function after the value.
 
template<class... Args, is::functionWithSignatureOrImplicitlyConvertible< value_type(const value_type &, Args &&...)> Fn>
constexpr void forEach (Fn &&fn, Args &&... fnArgs)
 Calls a function on each element and forwards fnArgs to the function after the value.
 
template<std::equality_comparable_with< ElementType > T>
constexpr auto find (const T &valueToLookFor)
 Returns an iterator to the first element that equals valueToLookFor or end() if none was found.
 
template<std::equality_comparable_with< ElementType > T>
constexpr auto find (const T &valueToLookFor) const
 Returns a const iterator to the first element that equals valueToLookFor or end() if none was found.
 
template<std::equality_comparable_with< ElementType > T>
constexpr auto findReverse (const T &valueToLookFor)
 Returns a reverse iterator to the last element in this vector that equals valueToLookFor or rend() if none was found.
 
template<std::equality_comparable_with< ElementType > T>
constexpr auto findReverse (const T &valueToLookFor) const
 Returns a const reverse iterator to the last element in this vector that equals valueToLookFor or rend() if none was found.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto findIf (Fn &&predicate)
 Returns an iterator to the first element in this vector for which predicate returns true or end() if none was found.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto findIf (Fn &&predicate) const
 Returns a const iterator to the first element in this vector for which predicate returns true or end() if none was found.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto findIfReverse (Fn &&predicate)
 Returns a reverse iterator to the last element in this vector for which predicate returns true or rend() if none was found.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto findIfReverse (Fn &&predicate) const
 Returns a const reverse iterator to the last element in this vector for which predicate returns true or rend() if none was found.
 
constexpr size_t count (const ElementType &valueToLookFor) const
 Returns the number of elements that are equal to valueToLookFor.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr size_t countIf (Fn &&predicate) const
 Returns the number of elements that satisfy predicate.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr bool all (Fn &&predicate) const
 Returns true if all elements satisfy the predicate or if the container is empty.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr bool any (Fn &&predicate) const
 Returns true if one or more elements satisfy the predicate.
 
template<std::equality_comparable_with< ElementType > T>
constexpr bool allElementsEqual (const T &value) const
 Returns true if all elements are equal to value or if the container is empty.
 
constexpr bool allElementsEqual () const
 Returns true if all elements are equal to themselves.
 
template<std::equality_comparable_with< ElementType > T>
constexpr bool contains (const T &value) const
 Returns true if at least one element is equal to value.
 
template<is::contiguousIteratorWithValueTypeSameAs< ElementType > It>
constexpr bool contains (It it) const
 Returns true if the iterator refers to an element inside this container or span.
 
template<std::equality_comparable_with< ElementType > T>
constexpr std::optional< size_t > indexOf (const T &value) const
 Returns the index of the first element that compares true to value or std::nullopt if none is found.
 
template<std::equality_comparable_with< ElementType > T>
constexpr std::optional< size_t > indexOfReverse (const T &value) const
 Returns the index of the last element that compares true to value or std::nullopt if none is found.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr std::optional< size_t > indexIf (Fn &&predicate) const
 Returns the index of the first element that satisfies the predicate or std::nullopt if none is found.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr std::optional< size_t > indexIfReverse (Fn &&predicate) const
 Returns the index of the last element that satisfies the predicate or std::nullopt if none is found.
 
constexpr std::optional< value_type > firstValueGreaterThanOrEqualTo (const value_type &valueToLookFor) const
 Returns a std::optional holding a copy of the first element value which is greater or equal to valueToLookFor or std::nullopt if no such value is found.
 
constexpr std::optional< value_type > firstValueGreaterThan (const value_type &valueToLookFor) const
 Returns a std::optional holding a copy of the first element value which is greater than valueToLookFor or std::nullopt if no such value is found.
 
constexpr void reverse ()
 Reverses the order of all elements.
 
constexpr void rotate (size_t newFirstElementIdx)
 Rotates the elements so that the element with the index newFirstElementIdx becomes the first element and the element with the index newFirstElementIdx - 1 becomes the last element.
 
void shiftLeft (size_t n, bool clearFreeSpaceAfterShiftedRegion)
 Shifts all elements to the left by n.
 
void shiftRight (size_t n, bool clearFreeSpaceBeforeShiftedRegion)
 Shifts all elements to the right by n.
 
constexpr void sort ()
 Sorts all elements in an ascending order using operator <=>.
 
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const value_type &, const value_type &)> ComparatorFn>
constexpr void sort (ComparatorFn &&compare)
 Sorts all elements in this vector according to the compare function.
 
constexpr bool elementsAreSorted () const
 Returns true if all elements are sorted.
 
NeonRegister< std::remove_const_t< ElementType > > getNeon (size_t i) const &&is
 Evaluates a certain expression in place on this vector, e.g.
 
constexpr bool isNotAliased (const void *) const
 
VCTR_FORCEDINLINE const ElementType * evalNextVectorOpInExpressionChain (void *) const
 
constexpr const StorageInfoTypegetStorageInfo () const
 
template<is::anyVctrOrExpression V>
constexpr void operator*= (const V &v)
 Multiplies this by a vector or expression in place.
 
constexpr void operator*= (value_type c)
 Multiplies this by a constant in place.
 
template<is::anyVctrOrExpression V>
constexpr void operator/= (const V &v)
 Divides this by a vector or expression in place.
 
constexpr void operator/= (value_type c)
 Divides this by a constant in place.
 
template<is::anyVctrOrExpression V>
constexpr void operator+= (const V &v)
 Adds a vector or expression to this in place.
 
constexpr void operator+= (value_type c)
 Adds a constant to this in place.
 
template<is::anyVctrOrExpression V>
constexpr void operator-= (const V &v)
 Subtracts a vector or expression from this in place.
 
constexpr void operator-= (value_type c)
 Subtracts a constant from this in place.
 
constexpr ElementType min () const
 Returns the minimal value of all elements.
 
constexpr ElementType minAbs () const
 Returns the minimal absolute value of all elements.
 
constexpr ElementType max () const
 Returns the maximum value of all elements.
 
constexpr ElementType maxAbs () const
 Returns the maximum absolute value of all elements.
 
constexpr ElementType mean () const
 Returns the mean value across all elements.
 
constexpr ElementType meanSquare () const
 Returns the mean value across all squared elements.
 
constexpr ElementType rms () const
 Returns the square root of the mean value across all squared elements.
 
constexpr ElementType sum () const
 Returns the sum of all elements.
 
constexpr bool allElementsAreFinite ()
 Returns true if all elements are finite.
 
constexpr bool allElementsAreFinite ()
 Returns true if all elements are finite.
 
constexpr bool anyElementIsNaN ()
 Returns true if any element is NaN.
 
constexpr bool anyElementIsNaN ()
 Returns true if any real or imaginary part of an element is NaN.
 

Static Public Member Functions

static consteval size_t getExtent (size_t amountToShrink=0)
 Returns the extent of this instance, optionally shrank by a certain amount.
 
static constexpr size_t size () noexcept
 Returns the number of elements.
 
static constexpr size_t sizeInBytes () noexcept
 Returns the container size in bytes.
 
static constexpr size_t backIdx () noexcept
 Returns the index referring to the last element in the vector.
 

Detailed Description

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
class vctr::Vector< ElementType, Allocator >

The heap-allocated container type.

Wraps a std::vector with a suitable Allocator. For arithmetic types, including std::complex, the default allocator will be a vctr::AlignedAllocator with an alignment of 32 bytes to speed up access when using SIMD accelerated evaluations. For other types, it will be std::allocator. If you want to override this default choice, simply pass in another allocator. This might be handy when you deliberately want a std::vector with the default std::allocator as underlying type, e.g. like

The heap-allocated container type.
Definition: Vector.h:99

There is one special case with Vector<bool>: For this particular case we don't use std::vector<bool> internally but a std::vector<std::byte> again wrapped in a thin compatibility layer. This allows converting a Vector<bool> into a Span<bool> which creates an overall better integration in the VCTR ecosystem but obviously makes it impossible to directly reference the underlying std::vector<bool> like it is possible for other types.

Template Parameters
ElementTypeThe type held by the Vector. May not be const.
AllocatorThe allocator as described above. You should not need to specify it in most cases.

Constructor & Destructor Documentation

◆ Vector() [1/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( )
constexprdefault

Creates an empty Vector with size = 0.

◆ Vector() [2/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<std::convertible_to< Allocator< ElementType > > Alloc>
vctr::Vector< ElementType, Allocator >::Vector ( Alloc &&  allocator)
inline

Creates an empty Vector that uses the specified allocator instance.

◆ Vector() [3/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( size_t  size)
inlineconstexpr

Creates an uninitialised Vector of the desired size.

◆ Vector() [4/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( size_t  size,
ElementType  initialValue 
)
inlineconstexpr

Creates a Vector with all elements initialised to initialValue of the desired size.

◆ Vector() [5/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( std::initializer_list< ElementType >  il)
inlineconstexpr

Creates a Vector from an initializer list.

◆ Vector() [6/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::suitableInitializerForElementType< ElementType > First, std::same_as< First >... Other>
requires (sizeof...(Other) > 0) && (! std::convertible_to<First, size_t>)
constexpr vctr::Vector< ElementType, Allocator >::Vector ( First &&  first,
Other &&...  other 
)
inlineconstexpr

Creates a Vector by moving a pack of elements into it.

◆ Vector() [7/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( const Vector< ElementType, Allocator > &  other)
inlineconstexpr

Creates a copy of the other Vector.

◆ Vector() [8/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( Vector< ElementType, Allocator > &&  other)
inlineconstexpr

Moves the other Vector into this one.

◆ Vector() [9/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::triviallyCopyableWithDataAndSize OtherContainer>
requires (! std::same_as<Vector, OtherContainer>)
constexpr vctr::Vector< ElementType, Allocator >::Vector ( const OtherContainer &  other)
inlineconstexpr

This constructor will create a Vector instance of the same size as OtherContainer and will copy its values into this Vector.

OtherContainer has to satisfy triviallyCopyableWithDataAndSize, that is

  • Its elements are trivially copyable
  • It supplies a size() member function returning the number of elements
  • It supplies a data() member function returning a raw pointer to the storage

◆ Vector() [10/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::iteratorCopyable OtherContainer>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( const OtherContainer &  other)
inlineconstexpr

This constructor will create a Vector instance of the same size as OtherContainer and will copy its values into this Vector.

OtherContainer has to satisfy iteratorCopyable, that is

  • It supplies a begin() and end() member function returning iterators
  • It does not satisfy triviallyCopyableWithDataAndSize

◆ Vector() [11/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( const ElementType *  data,
size_t  size 
)
inlineconstexpr

Copies size elements from the memory location pointed to by data.

◆ Vector() [12/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::inputIteratorToConstructValuesOfType< ElementType > Iterator, std::sentinel_for< Iterator > Sentinel>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( Iterator  first,
Sentinel  last 
)
inlineconstexpr

Creates an Vector from an iterator and a sentinel by initialising the Vector with the content read from the iterator.

◆ Vector() [13/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::suitableInitializerFunctionForElementType< ElementType > Fn>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( size_t  size,
Fn &&  initializerFunction 
)
inlineconstexpr

Creates a Vector of the given size and initialises all elements by calling initializerFunction with the element's index.

Template Parameters
Fnmust be a function that takes a size_t argument and returns a suitable element type.

◆ Vector() [14/14]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::expression Expression>
constexpr vctr::Vector< ElementType, Allocator >::Vector ( Expression &&  e)
inlineconstexpr

Creates a Vector from an expression.

Member Function Documentation

◆ all()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::all ( Fn &&  predicate) const
inlineconstexprinherited

Returns true if all elements satisfy the predicate or if the container is empty.

◆ allElementsAreFinite() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::allElementsAreFinite ( )
constexprinherited

Returns true if all elements are finite.

◆ allElementsAreFinite() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::allElementsAreFinite ( )
constexprinherited

Returns true if all elements are finite.

◆ allElementsEqual() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::allElementsEqual ( ) const
inlineconstexprinherited

Returns true if all elements are equal to themselves.

◆ allElementsEqual() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::allElementsEqual ( const T &  value) const
inlineconstexprinherited

Returns true if all elements are equal to value or if the container is empty.

◆ any()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::any ( Fn &&  predicate) const
inlineconstexprinherited

Returns true if one or more elements satisfy the predicate.

◆ anyElementIsNaN() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::anyElementIsNaN ( )
constexprinherited

Returns true if any element is NaN.

◆ anyElementIsNaN() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::anyElementIsNaN ( )
constexprinherited

Returns true if any real or imaginary part of an element is NaN.

◆ append()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::anyVctr VctrToAppend>
void vctr::Vector< ElementType, Allocator >::append ( VctrToAppend &&  vctrToAppend,
bool  moveValuesFromSrc = false 
)
inline

Appends a Span, Array or Vector to the end of this Vector, optionally by moving elements from the source.

◆ assign()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::assign ( std::initializer_list< ElementType >  elements)
inlineconstexprinherited

Assigns elements from the initializer list to this instance.

In case it is a resizable Vector, it will be resized to match the size of the list, otherwise the list size must match the destination size.

◆ at() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto & vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::at ( size_t  i)
inlineconstexprinherited

Returns a reference to element i.

Throws std::out_of_range if i >= size()

◆ at() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto & vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::at ( size_t  i) const
inlineconstexprinherited

Returns a reference to element i.

Throws std::out_of_range if i >= size()

◆ back() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto && vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::back ( )
inlineconstexprinherited

Returns a reference to the last element.

◆ back() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto && vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::back ( ) const
inlineconstexprinherited

Returns a reference to the last element.

◆ backIdx() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::backIdx ( ) const
inlineconstexprnoexceptinherited

Returns the index referring to the last element in the vector.

This overload is a non-static function, used in case the extent is dynamic.

◆ backIdx() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
static constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::backIdx ( )
inlinestaticconstexprnoexceptinherited

Returns the index referring to the last element in the vector.

This overload is a static function, used in case the extent is static.

◆ begin() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::begin ( )
inlineconstexprinherited

Returns an iterator to the begin of the storage.

◆ begin() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::begin ( ) const
inlineconstexprinherited

Returns a const iterator to the begin of the storage.

◆ capacity()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr size_t vctr::Vector< ElementType, Allocator >::capacity ( ) const
inlineconstexprnoexcept

Returns the number of elements the Vector can currently hold without re-allocation.

◆ clear()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr void vctr::Vector< ElementType, Allocator >::clear ( )
inlineconstexprnoexcept

Erase all elements from the Vector.

This is a standard interface function forwarded to std::vector::clear().

◆ contains() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::contains ( const T &  value) const
inlineconstexprinherited

Returns true if at least one element is equal to value.

◆ contains() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::contiguousIteratorWithValueTypeSameAs< ElementType > It>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::contains ( It  it) const
inlineconstexprinherited

Returns true if the iterator refers to an element inside this container or span.

It will return false in case it equals end().

◆ copyFrom()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::copyFrom ( const ElementType *  otherData,
size_t  otherSize 
)
inlineconstexprinherited

Copies the content from otherData to this instance.

In case the storage of this instance is resizable, it will resize it if necessary. Otherwise, it will simply assert that the size matches.

◆ count()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::count ( const ElementType &  valueToLookFor) const
inlineconstexprinherited

Returns the number of elements that are equal to valueToLookFor.

◆ countIf()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::countIf ( Fn &&  predicate) const
inlineconstexprinherited

Returns the number of elements that satisfy predicate.

◆ data() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
VCTR_FORCEDINLINE constexpr auto * vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::data ( )
inlineconstexprinherited

Returns a raw pointer to the underlying storage.

◆ data() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
VCTR_FORCEDINLINE constexpr auto * vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::data ( ) const
inlineconstexprinherited

Returns a raw pointer to the underlying storage.

◆ elementsAreSorted()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::elementsAreSorted ( ) const
inlineconstexprinherited

Returns true if all elements are sorted.

◆ emplace_back()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<class... Args>
constexpr void vctr::Vector< ElementType, Allocator >::emplace_back ( Args &&...  args)
inlineconstexpr

Constructs an element in-place at the end of the Vector.

This is a standard interface function forwarded to std::vector::emplace_back().

◆ empty()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr bool vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::empty ( ) const
inlineconstexprnoexceptinherited

Checks whether the container is empty.

◆ end() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::end ( )
inlineconstexprinherited

Returns an iterator to the first element behind the storage.

◆ end() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::end ( ) const
inlineconstexprinherited

Returns a const iterator to the first element behind the storage.

◆ erase() [1/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr auto vctr::Vector< ElementType, Allocator >::erase ( ConstIterator  elementToErase)
inlineconstexpr

Erases the element referenced by elementToErase and returns the iterator to the element behind it.

This is a standard interface function forwarded to std::vector::erase().

◆ erase() [2/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr auto vctr::Vector< ElementType, Allocator >::erase ( ConstIterator  first,
ConstIterator  last 
)
inlineconstexpr

Erases the range of elements referenced by it and returns the iterator to the element behind it.

First is expected to be contained in the range while last is expected to be the first element after that range.

This is a standard interface function forwarded to std::vector::erase().

◆ erase() [3/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr auto vctr::Vector< ElementType, Allocator >::erase ( size_t  idx)
inlineconstexpr

Erases the element at index idx and returns the iterator to the element behind it.

◆ erase() [4/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr auto vctr::Vector< ElementType, Allocator >::erase ( size_t  startIdx,
size_t  numElements 
)
inlineconstexpr

Erases numElements elements starting from index startIdx and returns the iterator to the element behind it.

◆ eraseAllOccurrencesIf()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr bool vctr::Vector< ElementType, Allocator >::eraseAllOccurrencesIf ( Fn &&  predicate)
inlineconstexpr

Removes all elements inside this Vector for which predicate is true and adjusts its size.

Returns true if one or more predicate matches have been found and corresponding elements have been erased, false otherwise.

◆ eraseAllOccurrencesOf()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<std::equality_comparable_with< ElementType > T>
constexpr bool vctr::Vector< ElementType, Allocator >::eraseAllOccurrencesOf ( const T &  value)
inlineconstexpr

Removes all occurrences of value from this Vector and adjusts its size.

Returns true if one or more occurrences have been found and erased, false otherwise.

◆ eraseFirstOccurrenceIf()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto vctr::Vector< ElementType, Allocator >::eraseFirstOccurrenceIf ( Fn &&  predicate)
inlineconstexpr

Erases the first occurrence for which predicate is true from this Vector and adjusts its size.

◆ eraseFirstOccurrenceOf()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<std::equality_comparable_with< ElementType > T>
constexpr auto vctr::Vector< ElementType, Allocator >::eraseFirstOccurrenceOf ( const T &  value)
inlineconstexpr

Erases the first occurrence of value from this Vector and adjusts its size.

◆ fill()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::fill ( const value_type &  value)
inlineconstexprinherited

Fills the container with the given value.

◆ fillLinspace()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::fillLinspace ( ElementType  start,
ElementType  stop,
bool  includeEnd = true 
)
inlineconstexprinherited

Fills the vector with evenly spaced numbers between start and stop.

Properties:

  • The length of the vector will not be changed and must be > 0.
  • If start and stop are identical, the container will be filled with that value.
  • Ranges can have a negative increment, i.e., start > stop is explicitly allowed.
Parameters
startFirst value of the interval; always included.
stopLast value of the interval; only included if includeEnd is true.
includeEndIf this is true, both start and stop are included; otherwise only start is included.

◆ find() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::find ( const T &  valueToLookFor)
inlineconstexprinherited

Returns an iterator to the first element that equals valueToLookFor or end() if none was found.

◆ find() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::find ( const T &  valueToLookFor) const
inlineconstexprinherited

Returns a const iterator to the first element that equals valueToLookFor or end() if none was found.

◆ findIf() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::findIf ( Fn &&  predicate)
inlineconstexprinherited

Returns an iterator to the first element in this vector for which predicate returns true or end() if none was found.

◆ findIf() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::findIf ( Fn &&  predicate) const
inlineconstexprinherited

Returns a const iterator to the first element in this vector for which predicate returns true or end() if none was found.

◆ findIfReverse() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::findIfReverse ( Fn &&  predicate)
inlineconstexprinherited

Returns a reverse iterator to the last element in this vector for which predicate returns true or rend() if none was found.

◆ findIfReverse() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::findIfReverse ( Fn &&  predicate) const
inlineconstexprinherited

Returns a const reverse iterator to the last element in this vector for which predicate returns true or rend() if none was found.

◆ findReverse() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::findReverse ( const T &  valueToLookFor)
inlineconstexprinherited

Returns a reverse iterator to the last element in this vector that equals valueToLookFor or rend() if none was found.

◆ findReverse() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::findReverse ( const T &  valueToLookFor) const
inlineconstexprinherited

Returns a const reverse iterator to the last element in this vector that equals valueToLookFor or rend() if none was found.

◆ firstValueGreaterThan()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr std::optional< value_type > vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::firstValueGreaterThan ( const value_type &  valueToLookFor) const
inlineconstexprinherited

Returns a std::optional holding a copy of the first element value which is greater than valueToLookFor or std::nullopt if no such value is found.

This function requires that the elements are sorted.

◆ firstValueGreaterThanOrEqualTo()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr std::optional< value_type > vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::firstValueGreaterThanOrEqualTo ( const value_type &  valueToLookFor) const
inlineconstexprinherited

Returns a std::optional holding a copy of the first element value which is greater or equal to valueToLookFor or std::nullopt if no such value is found.

This function requires that the elements are sorted.

◆ forEach() [1/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< void(value_type &)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn)
inlineconstexprinherited

Calls a function on each element.

The function returns void and might take the elements by reference to mutate them.

◆ forEach() [2/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< value_type(const value_type &)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn)
inlineconstexprinherited

Calls a function on each element.

The function returns a value_type which is assigned as new value to the element.

◆ forEach() [3/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< void(value_type &, size_t)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn)
inlineconstexprinherited

Calls a function on each element and passes the element index as second function argument.

The function returns void and might take the elements by reference to mutate them.

◆ forEach() [4/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< value_type(const value_type &, size_t)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn)
inlineconstexprinherited

Calls a function on each element and passes the element index as second function argument.

The function returns a value_type which is assigned as new value to the element.

◆ forEach() [5/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< void(const value_type &)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn) const
inlineconstexprinherited

Calls a function on each element.

The function returns void and must not mutate the elements.

◆ forEach() [6/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< void(const value_type &, size_t)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn) const
inlineconstexprinherited

Calls a function on each element and passes the element index as second function argument.

The function returns void and must not mutate the elements.

◆ forEach() [7/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<class... Args, is::functionWithSignatureOrImplicitlyConvertible< void(value_type &, Args &&...)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn,
Args &&...  fnArgs 
)
inlineconstexprinherited

Calls a function on each element and forwards fnArgs to the function after the value.

The function returns void and might take the elements by reference to mutate them.

◆ forEach() [8/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<class... Args, is::functionWithSignatureOrImplicitlyConvertible< value_type(const value_type &, Args &&...)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn,
Args &&...  fnArgs 
)
inlineconstexprinherited

Calls a function on each element and forwards fnArgs to the function after the value.

The function returns a value_type which is assigned as new value to the element.

◆ forEach() [9/9]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<class... Args, is::functionWithSignatureOrImplicitlyConvertible< void(const value_type &, Args &&...)> Fn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::forEach ( Fn &&  fn,
Args &&...  fnArgs 
) const
inlineconstexprinherited

Calls a function on each element and forwards fnArgs to the function after the value.

The function returns void and must not mutate the elements.

◆ front() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto && vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::front ( )
inlineconstexprinherited

Returns a reference to the first element.

◆ front() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto && vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::front ( ) const
inlineconstexprinherited

Returns a reference to the first element.

◆ get_allocator()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr Allocator< ElementType > vctr::Vector< ElementType, Allocator >::get_allocator ( ) const
inlineconstexprnoexcept

Returns the allocator associated with the Vector.

This is a standard interface function forwarded to std::vector::get_allocator().

◆ getExtent()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
static consteval size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::getExtent ( size_t  amountToShrink = 0)
inlinestaticinherited

Returns the extent of this instance, optionally shrank by a certain amount.

In case the instance specifies a dynamic extent, the return value will always be std::dynamic_extent, no matter if we specified an amount to shrink. In case the instance specifies a static extent, the return value will be extent - amountToShrink.

◆ getNeon()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
NeonRegister< std::remove_const_t< ElementType > > vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::getNeon ( size_t  i) const &&
inlineinherited

Evaluates a certain expression in place on this vector, e.g.

it assigns the expression result back to the vector.

◆ getUnderlyingVector() [1/2]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr StdVectorType & vctr::Vector< ElementType, Allocator >::getUnderlyingVector ( )
inlineconstexpr

Returns a reference to the underlying storage.

The returned type is std::vector, possibly with a custom allocator type.

◆ getUnderlyingVector() [2/2]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr const StdVectorType & vctr::Vector< ElementType, Allocator >::getUnderlyingVector ( ) const
inlineconstexpr

Returns a reference to the underlying storage.

The returned type is std::vector, possibly with a custom allocator type.

◆ indexIf()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr std::optional< size_t > vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::indexIf ( Fn &&  predicate) const
inlineconstexprinherited

Returns the index of the first element that satisfies the predicate or std::nullopt if none is found.

◆ indexIfReverse()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const ElementType &)> Fn>
constexpr std::optional< size_t > vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::indexIfReverse ( Fn &&  predicate) const
inlineconstexprinherited

Returns the index of the last element that satisfies the predicate or std::nullopt if none is found.

◆ indexOf()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr std::optional< size_t > vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::indexOf ( const T &  value) const
inlineconstexprinherited

Returns the index of the first element that compares true to value or std::nullopt if none is found.

◆ indexOfReverse()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<std::equality_comparable_with< ElementType > T>
constexpr std::optional< size_t > vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::indexOfReverse ( const T &  value) const
inlineconstexprinherited

Returns the index of the last element that compares true to value or std::nullopt if none is found.

◆ init() [1/2]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr void vctr::Vector< ElementType, Allocator >::init ( size_t  newSize,
const value_type &  value 
)
inlineconstexpr

Resizes this vector to newSize and fills it with the given value.

See also
resize, fill.

◆ init() [2/2]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::suitableInitializerFunctionForElementType< ElementType > Fn>
constexpr void vctr::Vector< ElementType, Allocator >::init ( size_t  newSize,
Fn &&  initializerFunction 
)
inlineconstexpr

Resizes this vector to newSize and fills it via the given initializerFunction.

See also
resize, fill.

◆ insert() [1/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( ConstIterator  pos,
const ElementType &  value 
)
inline

Inserts value before the element referenced by pos and returns an iterator to the inserted value.

pos must refer to an element in this Vector.

This is a standard interface function forwarded to std::vector::insert().

◆ insert() [2/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( ConstIterator  pos,
ElementType &&  value 
)
inline

Inserts value before the element referenced by pos and returns an iterator to the inserted value.

pos must refer to an element in this Vector.

This is a standard interface function forwarded to std::vector::insert().

◆ insert() [3/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::inputIteratorToConstructValuesOfType< ElementType > InputIterator>
auto vctr::Vector< ElementType, Allocator >::insert ( ConstIterator  pos,
InputIterator  first,
InputIterator  last 
)
inline

Inserts a range of values before the element referenced by pos and returns an iterator to the inserted values.

pos must refer to an element in this Vector, first and last must denote the begin and end of the range to be inserted. The inserted range must not be part of this Vector.

This is a standard interface function forwarded to std::vector::insert().

◆ insert() [4/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( ConstIterator  pos,
size_t  numCopies,
const ElementType &  value 
)
inline

Inserts numCopies copies of value before the element referenced by pos and returns an iterator to the inserted values.

pos must refer to an element in this Vector.

This is a standard interface function forwarded to std::vector::insert().

◆ insert() [5/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( ConstIterator  pos,
std::initializer_list< ElementType >  initList 
)
inline

Inserts a list of values before the element referenced by pos and returns an iterator to the first inserted value.

pos must refer to an element in this Vector.

This is a standard interface function forwarded to std::vector::insert().

◆ insert() [6/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::anyVctr VctrToInsert>
auto vctr::Vector< ElementType, Allocator >::insert ( ConstIterator  pos,
VctrToInsert &&  vctrToInsert,
bool  moveValuesFromSrc = false 
)
inline

Inserts a VCTR container before the element referenced by pos and returns an iterator to the first inserted value.

pos must refer to an element in this Vector. If moveValuesFromSrc is true, the function attempts that it's safe to move the values out of vtrToInsert even if we pass it by reference or as a vctr::Span. This will invalidate that source values.

◆ insert() [7/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( size_t  idx,
const ElementType &  value 
)
inline

Inserts value at index idx and returns an iterator to the inserted value.

◆ insert() [8/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( size_t  idx,
ElementType &&  value 
)
inline

Inserts value at index idx and returns an iterator to the inserted value.

◆ insert() [9/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::inputIteratorToConstructValuesOfType< ElementType > InputIterator>
auto vctr::Vector< ElementType, Allocator >::insert ( size_t  idx,
InputIterator  first,
InputIterator  last 
)
inline

Inserts a range of values at index idx and returns an iterator to the inserted values.

First and last must denote the begin and end of the range to be inserted. The inserted range must not be part of this Vector.

◆ insert() [10/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( size_t  idx,
size_t  numCopies,
const ElementType &  value 
)
inline

Inserts numCopies copies of value at index idx and returns an iterator to the inserted values.

◆ insert() [11/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
auto vctr::Vector< ElementType, Allocator >::insert ( size_t  idx,
std::initializer_list< ElementType >  initList 
)
inline

Inserts a list of values at index idx and returns an iterator to the first inserted value.

◆ insert() [12/12]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::anyVctr VctrToInsert>
auto vctr::Vector< ElementType, Allocator >::insert ( size_t  idx,
VctrToInsert &&  vctrToInsert,
bool  moveValuesFromSrc = false 
)
inline

Inserts a VCTR container at index idx and returns an iterator to the first inserted value.

If moveValuesFromSrc is true, the function attempts that it's safe to move the values out of vtrToInsert even if we pass it by reference or as a vctr::Span. This will invalidate that source values.

◆ max()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::max ( ) const
constexprinherited

Returns the maximum value of all elements.

◆ max_size()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr size_t vctr::Vector< ElementType, Allocator >::max_size ( ) const
inlineconstexprnoexcept

Returns the maximum number of elements the container is able to hold.

◆ maxAbs()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::maxAbs ( ) const
constexprinherited

Returns the maximum absolute value of all elements.

◆ mean()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::mean ( ) const
constexprinherited

Returns the mean value across all elements.

◆ meanSquare()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::meanSquare ( ) const
constexprinherited

Returns the mean value across all squared elements.

◆ min()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::min ( ) const
constexprinherited

Returns the minimal value of all elements.

◆ minAbs()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::minAbs ( ) const
constexprinherited

Returns the minimal absolute value of all elements.

◆ moveUnderlyingVector()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr StdVectorType && vctr::Vector< ElementType, Allocator >::moveUnderlyingVector ( ) &&
inlineconstexpr

Moves the underlying storage out of this wrapper class.

The returned type is std::vector, possibly with a custom allocator type.

◆ operator const StdVectorType &()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::operator const StdVectorType & ( ) const
inlineconstexpr

Conversion operator shortcut to getUnderlyingVector.

◆ operator std::vector< ElementType, OtherAllocator >()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<class OtherAllocator >
requires isDifferentAllocatorTypeWithSameValueType<OtherAllocator>
vctr::Vector< ElementType, Allocator >::operator std::vector< ElementType, OtherAllocator > ( ) const
inline

Conversion operator that allows us to assign this Vector to a std::vector with different allocator type.

Note that values will be copied here and that the destination Vector might allocate memory.

◆ operator StdVectorType &()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr vctr::Vector< ElementType, Allocator >::operator StdVectorType & ( )
inlineconstexpr

Conversion operator shortcut to getUnderlyingVector.

◆ operator*=() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::anyVctrOrExpression V>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator*= ( const V &  v)
constexprinherited

Multiplies this by a vector or expression in place.

◆ operator*=() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator*= ( value_type  c)
constexprinherited

Multiplies this by a constant in place.

◆ operator+=() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::anyVctrOrExpression V>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator+= ( const V &  v)
constexprinherited

Adds a vector or expression to this in place.

In the special case where a multiplication expression is assigned for which none of the operands are expressions themselves, this will try to use accelerated multiply accumulate operations to evaluate the expression.

Example:

// This code tries to use an accelerated multiply accumulate operation as it can access the values of a and b right away
c += a * b;
c += a * 42.0f;
// Cannot directly evaluate the accelerated operation as vctr::square (b) would have to be evaluated and stored to
// some temporary memory location first.
c += a * vctr::square (b);
The stack-based container type.
Definition: Array.h:53
constexpr ExpressionChainBuilder< expressions::Square > square
Squares the source values.
Definition: Square.h:93

◆ operator+=() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator+= ( value_type  c)
constexprinherited

Adds a constant to this in place.

◆ operator-=() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::anyVctrOrExpression V>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator-= ( const V &  v)
constexprinherited

Subtracts a vector or expression from this in place.

◆ operator-=() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator-= ( value_type  c)
constexprinherited

Subtracts a constant from this in place.

◆ operator/=() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::anyVctrOrExpression V>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator/= ( const V &  v)
constexprinherited

Divides this by a vector or expression in place.

◆ operator/=() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator/= ( value_type  c)
constexprinherited

Divides this by a constant in place.

◆ operator=() [1/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<is::expression E>
constexpr void vctr::Vector< ElementType, Allocator >::operator= ( const E &  expression)
inlineconstexpr

Assigns the result of an expression to this Vector.

It may resize the Vector if it does not match the expression size.

◆ operator=() [2/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr Vector & vctr::Vector< ElementType, Allocator >::operator= ( const Vector< ElementType, Allocator > &  other)
inlineconstexpr

Copy assignment operator.

◆ operator=() [3/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
template<has::sizeAndDataWithElementType< ElementType > Container>
constexpr Vector & vctr::Vector< ElementType, Allocator >::operator= ( Container &&  containerToCopyDataFrom)
inlineconstexpr

Copies or moves the data of the source container to this Vector.

This Vector will be resized to fit if needed.

◆ operator=() [4/4]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr Vector & vctr::Vector< ElementType, Allocator >::operator= ( std::initializer_list< ElementType >  elementsToAssign)
inlineconstexpr

Assigns elements from the intializer list to this Vector.

This Vector will be resized to fit if needed.

◆ operator[]() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto & vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator[] ( size_t  i)
inlineconstexprinherited

Returns a reference to element i.

Asserts in debug builds if i >= size()

◆ operator[]() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto & vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::operator[] ( size_t  i) const
inlineconstexprinherited

Returns a reference to element i.

Asserts in debug builds if i >= size()

◆ pop_back()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr ElementType vctr::Vector< ElementType, Allocator >::pop_back ( )
inlineconstexpr

Removes the last element in the vector, effectively reducing the container size by one.

In addition to std::vector::pop_back, this implementation also return the popped element. Calling pop_back on an empty vector causes undefined behaviour.

◆ push_back() [1/2]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr ElementType & vctr::Vector< ElementType, Allocator >::push_back ( const ElementType &  newElement)
inlineconstexpr

Adds an element to the end of the Vector.

This is a standard interface function forwarded to std::vector::push_back() but it adds a return value.

Returns
a reference to the just added element.

◆ push_back() [2/2]

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr ElementType & vctr::Vector< ElementType, Allocator >::push_back ( ElementType &&  newElement)
inlineconstexpr

Adds an element to the end of the Vector.

This is a standard interface function forwarded to std::vector::push_back() but it adds a return value.

Returns
a reference to the just added element.

◆ rbegin() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::rbegin ( )
inlineconstexprinherited

Returns a reverse iterator to the last element in the storage.

◆ rbegin() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::rbegin ( ) const
inlineconstexprinherited

Returns a const reverse iterator to the last element in the storage.

◆ rend() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::rend ( )
inlineconstexprinherited

Returns a reverse iterator to the element before the first element in the storage.

◆ rend() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::rend ( ) const
inlineconstexprinherited

Returns a const reverse iterator to the element before the first element in the storage.

◆ reserve()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr void vctr::Vector< ElementType, Allocator >::reserve ( size_t  i)
inlineconstexpr

Pre-allocates memory for the given number of elements.

This is a standard interface function forwarded to std::vector::reserve().

◆ resize()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr void vctr::Vector< ElementType, Allocator >::resize ( size_t  i)
inlineconstexpr

Changes the size of this Vector, potentially allocating memory.

This is a standard interface function forwarded to std::vector::resize().

◆ reverse()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::reverse ( )
inlineconstexprinherited

Reverses the order of all elements.

◆ rms()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::rms ( ) const
constexprinherited

Returns the square root of the mean value across all squared elements.

◆ rotate()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::rotate ( size_t  newFirstElementIdx)
inlineconstexprinherited

Rotates the elements so that the element with the index newFirstElementIdx becomes the first element and the element with the index newFirstElementIdx - 1 becomes the last element.

◆ shiftLeft()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::shiftLeft ( size_t  n,
bool  clearFreeSpaceAfterShiftedRegion 
)
inlineinherited

Shifts all elements to the left by n.

In other words: It shifts the elements so that the element with the index n becomes the first element. If clearFreeSpaceAfterShiftedRegion is true, it clears all elements behind the shifted region by setting the memory to 0, otherwise it leaves that region as it was. For maximum efficiency, this works on a raw memory basis, so the elements have to be trivially copyable.

◆ shiftRight()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::shiftRight ( size_t  n,
bool  clearFreeSpaceBeforeShiftedRegion 
)
inlineinherited

Shifts all elements to the right by n.

In other words: It shifts the elements so that the previous first element now is the element with the index n. If clearFreeSpaceBeforeShiftedRegion is true, it clears all elements before the shifted region by setting the memory to 0, otherwise it leaves that region as it was. For maximum efficiency, this works on a raw memory basis, so the elements have to be trivially copyable.

◆ shrink_to_fit()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr void vctr::Vector< ElementType, Allocator >::shrink_to_fit ( )
inlineconstexpr

Adjusts the allocated memory to the actual number of elements.

This is a standard interface function forwarded to std::vector::shrink_to_fit().

◆ size() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::size ( ) const
inlineconstexprnoexceptinherited

Returns the number of elements.

This overload is a non-static function, used in case the extent is dynamic.

◆ size() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
static constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::size ( )
inlinestaticconstexprnoexceptinherited

Returns the number of elements.

This overload is a static function, used in case the extent is static.

◆ sizeInBytes() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::sizeInBytes ( ) const
inlineconstexprnoexceptinherited

Returns the container size in bytes.

This overload is a non-static function, used in case the extent is dynamic.

◆ sizeInBytes() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
static constexpr size_t vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::sizeInBytes ( )
inlinestaticconstexprnoexceptinherited

Returns the container size in bytes.

This overload is a static function, used in case the extent is static.

◆ sort() [1/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::sort ( )
inlineconstexprinherited

Sorts all elements in an ascending order using operator <=>.

◆ sort() [2/2]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<is::functionWithSignatureOrImplicitlyConvertible< bool(const value_type &, const value_type &)> ComparatorFn>
constexpr void vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::sort ( ComparatorFn &&  compare)
inlineconstexprinherited

Sorts all elements in this vector according to the compare function.

The compare function should receive true if the first argument is less than the second argument.

◆ subSpan() [1/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<size_t startIdx>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( )
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.

This overload with a compile time static index will return a Span with a static extent in case this instance also has a static extent.

◆ subSpan() [2/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<size_t startIdx, size_t numElements>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( )
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.

This overload with a compile time static length will always return a Span with a static extent.

◆ subSpan() [3/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<size_t startIdx>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( ) const
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.

This overload with a compile time static index will return a Span with a static extent in case this instance also has a static extent.

◆ subSpan() [4/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
template<size_t startIdx, size_t numElements>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( ) const
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.

This overload with a compile time static length will always return a Span with a static extent.

◆ subSpan() [5/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( size_t  startIdx)
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.

This overload with a runtime defined index will always return a Span with a dynamic extent.

◆ subSpan() [6/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( size_t  startIdx) const
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of size() - startIdx.

This overload with a runtime defined index will always return a Span with a dynamic extent.

◆ subSpan() [7/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( size_t  startIdx,
size_t  numElements 
)
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.

This overload with a runtime defined length will always return a Span with a dynamic extent.

◆ subSpan() [8/8]

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr auto vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::subSpan ( size_t  startIdx,
size_t  numElements 
) const
inlineconstexprinherited

Returns a Span that views a portion of this instance, starting at startIdx with a length of numElements.

This overload with a runtime defined length will always return a Span with a dynamic extent.

◆ sum()

template<class ElementType , class StorageType , size_t extent, class StorageInfoType = StorageInfo<StorageType>>
constexpr ElementType vctr::VctrBase< ElementType, StorageType, extent, StorageInfoType >::sum ( ) const
constexprinherited

Returns the sum of all elements.

◆ swap()

template<is::nonConst ElementType, template< class > class Allocator = DefaultVectorAllocator>
constexpr void vctr::Vector< ElementType, Allocator >::swap ( Vector< ElementType, Allocator > &  other)
inlineconstexprnoexcept

Swaps the underlying memory with the other Vector.

This is a standard interface function forwarded to std::vector::swap().


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