fiber
Loading...
Searching...
No Matches
fiber::LeftDualArrayListRef< T, N > Class Template Reference

A reference to the left side of a DualArrayList. More...

#include <DualArrayList.hpp>

Public Types

using value_type = DualArrayList<T, N>::value_type
 
using size_type = DualArrayList<T, N>::size_type
 
using reference = DualArrayList<T, N>::reference
 
using const_reference = DualArrayList<T, N>::const_reference
 
using iterator = DualArrayList<T, N>::left_iterator
 
using const_iterator = DualArrayList<T, N>::left_const_iterator
 
using pointer = DualArrayList<T, N>::pointer
 
using const_pointer = DualArrayList<T, N>::const_pointer
 

Public Member Functions

 LeftDualArrayListRef (DualArrayList< T, N > &list)
 
constexpr size_type size () const
 returns the size/count of live elements in the container
 
constexpr size_type capacity () const
 returns the capacity of the container. Since this is a statically allocated container this is also the maximal size.
 
constexpr size_type max_size () const
 returns the maximal number of elements that can be stored in the container
 
constexpr size_type reserve () const
 returns the reserve - number of elements that can be stored until the container is full
 
constexpr bool empty () const
 returns true if there are not elements in the container, aka. the container is empty.
 
constexpr bool full () const
 returns true if the container is full and no more elements can be stored in the container
 
constexpr iterator begin ()
 returns an iterator to the start
 
constexpr const_iterator begin () const
 returns a const-iterator to the start
 
constexpr const_iterator cbegin () const
 returns a const-iterator to the start
 
constexpr iterator end ()
 returns an iterator past the end
 
constexpr const_iterator end () const
 returns a const-iterator past the end
 
constexpr const_iterator cend () const
 returns a const-iterator past the end
 
constexpr T & front ()
 returns a reference to the first element in the buffer
 
constexpr const T & front () const
 returns a const-reference to the first element int the buffer
 
constexpr T & back ()
 returns a reference to the last element in the buffer
 
constexpr const T & back () const
 returns a const reference to the last element in the buffer
 
template<std::integral Int>
constexpr T & at (const Int i)
 returns a reference to the element at the given position
 
template<std::integral Int>
constexpr const T & at (const Int i) const
 returns a reference to the element at the given position
 
ArrayList< T, N > at (const ArrayList< bool, N > &mask) const
 Masked indexing.
 
template<std::integral Int>
ArrayList< T, N > at (const ArrayList< Int, N > &indices) const
 Inices list indexing.
 
template<std::integral Int>
constexpr T & operator[] (const Int i)
 returns a reference to the element at the given position
 
template<std::integral Int>
constexpr const T & operator[] (const Int i) const
 returns a reference to the element at the given position
 
ArrayList< T, N > operator[] (const ArrayList< bool, N > &mask) const
 accesses all elements where mask is true
 
template<std::integral Int>
ArrayList< T, N > operator[] (const ArrayList< Int, N > &indices) const
 accesses all elements at the given indices
 
template<class... Args>
T & emplace_back (Args &&... args)
 emplaces (aka. pushes) an element to the back of the list
 
void clear ()
 clears the list - destructs all members if necessary and sets the size to zero
 
void append (const size_type count, const T &value)
 appends value count many times
 
void assign (const size_type count, const T &value)
 assigns a value to the list. after which value is the only element in the list
 
template<std::forward_iterator Itr>
void append (Itr first, Itr last)
 appends a range defined by foreward iterators using the closed-open principle [first, last)
 
template<std::forward_iterator Itr>
void assign (Itr first, Itr last)
 assigns a range defined by foreward iterators using the closed-open principle [first, last). After the assignment the list has the size of the assigned range
 
void append (std::initializer_list< T > ilist)
 appens an initilizer_list
 
void assign (std::initializer_list< T > ilist)
 assigns an initializer_list
 
template<std::ranges::forward_range Range>
void append (const Range &range)
 Appends the content of a range.
 
template<std::ranges::forward_range Range>
void assign (const Range &range)
 Assigns the content of a range.
 
constexpr size_type to_index (const const_iterator pos) const
 turns the passed position given by an iterator into an integer
 
template<std::integral Int>
constexpr iterator to_iterator (const Int pos)
 turns the passed unsigned integer into an iterator pointing to the same position
 
template<std::integral Int>
constexpr const_iterator to_iterator (const Int pos) const
 turns the passed unsigned integer into a cosnt_iterator pointing to the same position
 
template<std::integral Int>
constexpr const_iterator to_const_iterator (const Int pos) const
 turns the passed unsigned integer into a cosnt_iterator pointing to the same position
 
constexpr iterator unconst (const const_iterator pos)
 removes the constnes of an iterator if the user has access to the mutable (un-const) container
 
iterator insert (const const_iterator pos, const T &value)
 Inserts a value.
 
iterator insert (const const_iterator pos, T &&value)
 Inserts a value.
 
template<std::forward_iterator Itr>
iterator insert (const const_iterator pos, Itr first, Itr last)
 inserts a range at a given position
 
template<std::ranges::forward_range Range>
iterator insert (const const_iterator pos, const Range &range)
 inserts a range at the given position
 
iterator insert (const const_iterator pos, const std::initializer_list< T > &ilist)
 
template<std::integral Int>
iterator insert (const Int pos, const T &value)
 inserts the value at the position passed as an integer that wraps if it is a signed type
 
template<std::integral Int>
iterator insert (const Int pos, T &&value)
 inserts the value at the position passed as an integer that wraps if it is a signed type
 
template<std::integral Int, std::ranges::forward_range Range>
iterator insert (const Int pos, const Range &range)
 inserts the range at the position passed as an integer that wraps if it is a signed type
 
template<std::integral Int>
iterator insert (const Int pos, const std::initializer_list< T > &ilist)
 
template<std::integral Int, std::forward_iterator Itr>
iterator insert (const Int pos, Itr first, Itr last)
 inserts the closed-open [first, last) range at the given position
 
iterator erase (const_iterator cpos)
 erases/removes the element at the position pointed to by cpos
 
template<std::integral Int>
iterator erase (const Int pos)
 erases/removes the element at the position pointed to by cpos
 
iterator erase (const_iterator first, const_iterator last)
 erases/removes the range given by the closed-open iterators [first, last)
 
template<class Callable>
std::size_t erase_if (Callable &&f)
 erases elements from the list if they satisfy the callable
 
template<std::integral Int>
iterator erase (Int first, Int last)
 erases/removes the range given by the closed-open indices [first, last)
 
void pop_back ()
 removes and destructs the last element
 
ArrayList< bool, N > operator! () const
 Applies the negation (!) operator to all elements and returns it as a bool list.
 
template<class Function>
constexpr void for_each (Function &&function)
 Applies the function to each element of the list in-place.
 

Detailed Description

template<class T, std::size_t N>
class fiber::LeftDualArrayListRef< T, N >

A reference to the left side of a DualArrayList.

See also
DualArrayList

Member Typedef Documentation

◆ const_iterator

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::const_iterator = DualArrayList<T, N>::left_const_iterator

◆ const_pointer

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::const_pointer = DualArrayList<T, N>::const_pointer

◆ const_reference

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::const_reference = DualArrayList<T, N>::const_reference

◆ iterator

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::iterator = DualArrayList<T, N>::left_iterator

◆ pointer

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::pointer = DualArrayList<T, N>::pointer

◆ reference

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::reference = DualArrayList<T, N>::reference

◆ size_type

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::size_type = DualArrayList<T, N>::size_type

◆ value_type

template<class T, std::size_t N>
using fiber::LeftDualArrayListRef< T, N >::value_type = DualArrayList<T, N>::value_type

Constructor & Destructor Documentation

◆ LeftDualArrayListRef()

template<class T, std::size_t N>
fiber::LeftDualArrayListRef< T, N >::LeftDualArrayListRef ( DualArrayList< T, N > & list)
inline

Member Function Documentation

◆ append() [1/4]

template<class T, std::size_t N>
template<std::ranges::forward_range Range>
void fiber::LeftDualArrayListRef< T, N >::append ( const Range & range)
inline

Appends the content of a range.

◆ append() [2/4]

template<class T, std::size_t N>
void fiber::LeftDualArrayListRef< T, N >::append ( const size_type count,
const T & value )
inline

appends value count many times

Parameters
counthow often value should be emplaced_back()
valuethe value to be created

◆ append() [3/4]

template<class T, std::size_t N>
template<std::forward_iterator Itr>
void fiber::LeftDualArrayListRef< T, N >::append ( Itr first,
Itr last )
inline

appends a range defined by foreward iterators using the closed-open principle [first, last)

◆ append() [4/4]

template<class T, std::size_t N>
void fiber::LeftDualArrayListRef< T, N >::append ( std::initializer_list< T > ilist)
inline

appens an initilizer_list

◆ assign() [1/4]

template<class T, std::size_t N>
template<std::ranges::forward_range Range>
void fiber::LeftDualArrayListRef< T, N >::assign ( const Range & range)
inline

Assigns the content of a range.

◆ assign() [2/4]

template<class T, std::size_t N>
void fiber::LeftDualArrayListRef< T, N >::assign ( const size_type count,
const T & value )
inline

assigns a value to the list. after which value is the only element in the list

◆ assign() [3/4]

template<class T, std::size_t N>
template<std::forward_iterator Itr>
void fiber::LeftDualArrayListRef< T, N >::assign ( Itr first,
Itr last )
inline

assigns a range defined by foreward iterators using the closed-open principle [first, last). After the assignment the list has the size of the assigned range

◆ assign() [4/4]

template<class T, std::size_t N>
void fiber::LeftDualArrayListRef< T, N >::assign ( std::initializer_list< T > ilist)
inline

assigns an initializer_list

◆ at() [1/4]

template<class T, std::size_t N>
ArrayList< T, N > fiber::LeftDualArrayListRef< T, N >::at ( const ArrayList< bool, N > & mask) const
inline

Masked indexing.

Parameters
maskthe mask that selects which elements to get. true will be included, false excluded
Returns
A ArrayList that contains all values where of this where mask is true

◆ at() [2/4]

template<class T, std::size_t N>
template<std::integral Int>
ArrayList< T, N > fiber::LeftDualArrayListRef< T, N >::at ( const ArrayList< Int, N > & indices) const
inline

Inices list indexing.

Template Parameters
Inta generic integer
Parameters
indicesa list of indices that should be extracted
Returns
a ArrayList containing all the elements from this that are contained in the indices

◆ at() [3/4]

template<class T, std::size_t N>
template<std::integral Int>
T & fiber::LeftDualArrayListRef< T, N >::at ( const Int i)
inlineconstexpr

returns a reference to the element at the given position

◆ at() [4/4]

template<class T, std::size_t N>
template<std::integral Int>
const T & fiber::LeftDualArrayListRef< T, N >::at ( const Int i) const
inlineconstexpr

returns a reference to the element at the given position

◆ back() [1/2]

template<class T, std::size_t N>
T & fiber::LeftDualArrayListRef< T, N >::back ( )
inlineconstexpr

returns a reference to the last element in the buffer

◆ back() [2/2]

template<class T, std::size_t N>
const T & fiber::LeftDualArrayListRef< T, N >::back ( ) const
inlineconstexpr

returns a const reference to the last element in the buffer

◆ begin() [1/2]

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::begin ( )
inlineconstexpr

returns an iterator to the start

◆ begin() [2/2]

template<class T, std::size_t N>
const_iterator fiber::LeftDualArrayListRef< T, N >::begin ( ) const
inlineconstexpr

returns a const-iterator to the start

◆ capacity()

template<class T, std::size_t N>
size_type fiber::LeftDualArrayListRef< T, N >::capacity ( ) const
inlineconstexpr

returns the capacity of the container. Since this is a statically allocated container this is also the maximal size.

◆ cbegin()

template<class T, std::size_t N>
const_iterator fiber::LeftDualArrayListRef< T, N >::cbegin ( ) const
inlineconstexpr

returns a const-iterator to the start

◆ cend()

template<class T, std::size_t N>
const_iterator fiber::LeftDualArrayListRef< T, N >::cend ( ) const
inlineconstexpr

returns a const-iterator past the end

◆ clear()

template<class T, std::size_t N>
void fiber::LeftDualArrayListRef< T, N >::clear ( )
inline

clears the list - destructs all members if necessary and sets the size to zero

◆ emplace_back()

template<class T, std::size_t N>
template<class... Args>
T & fiber::LeftDualArrayListRef< T, N >::emplace_back ( Args &&... args)
inline

emplaces (aka. pushes) an element to the back of the list

Actually constructs an element in place

Template Parameters
...Argslist of parameters that correspond to a constructor of the value type of the list
Parameters
...argslist of arguments to construct a value of the list
Returns
a reference to the constructed list element

◆ empty()

template<class T, std::size_t N>
bool fiber::LeftDualArrayListRef< T, N >::empty ( ) const
inlineconstexpr

returns true if there are not elements in the container, aka. the container is empty.

◆ end() [1/2]

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::end ( )
inlineconstexpr

returns an iterator past the end

◆ end() [2/2]

template<class T, std::size_t N>
const_iterator fiber::LeftDualArrayListRef< T, N >::end ( ) const
inlineconstexpr

returns a const-iterator past the end

◆ erase() [1/4]

template<class T, std::size_t N>
template<std::integral Int>
iterator fiber::LeftDualArrayListRef< T, N >::erase ( const Int pos)
inline

erases/removes the element at the position pointed to by cpos

does not perform out of bounds checks

Returns
an iterator the element after the removed one

◆ erase() [2/4]

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::erase ( const_iterator cpos)
inline

erases/removes the element at the position pointed to by cpos

does not perform out of bounds checks

Returns
an iterator the element after the removed one

◆ erase() [3/4]

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::erase ( const_iterator first,
const_iterator last )
inline

erases/removes the range given by the closed-open iterators [first, last)

does not perform out of bounds checks

Returns
an iterator the element after the removed ones

◆ erase() [4/4]

template<class T, std::size_t N>
template<std::integral Int>
iterator fiber::LeftDualArrayListRef< T, N >::erase ( Int first,
Int last )
inline

erases/removes the range given by the closed-open indices [first, last)

does not perform out of bounds checks

Returns
an iterator the element after the removed ones

◆ erase_if()

template<class T, std::size_t N>
template<class Callable>
std::size_t fiber::LeftDualArrayListRef< T, N >::erase_if ( Callable && f)
inline

erases elements from the list if they satisfy the callable

Template Parameters
CallableObject that can be called like bool f(const T&) or bool f(T).
Parameters
fCondition that returns true if that element should be erased from the list.

◆ for_each()

template<class T, std::size_t N>
template<class Function>
void fiber::LeftDualArrayListRef< T, N >::for_each ( Function && function)
inlineconstexpr

Applies the function to each element of the list in-place.

Note
This is an in-place operation and will change the list. If you want to create a new list with the transformed values, use fiber::for_each(const ArrayList<T, N>&, std::function<T, const T&> function) instead
Parameters
functionthe function being applied to change/transform each element

◆ front() [1/2]

template<class T, std::size_t N>
T & fiber::LeftDualArrayListRef< T, N >::front ( )
inlineconstexpr

returns a reference to the first element in the buffer

◆ front() [2/2]

template<class T, std::size_t N>
const T & fiber::LeftDualArrayListRef< T, N >::front ( ) const
inlineconstexpr

returns a const-reference to the first element int the buffer

◆ full()

template<class T, std::size_t N>
bool fiber::LeftDualArrayListRef< T, N >::full ( ) const
inlineconstexpr

returns true if the container is full and no more elements can be stored in the container

◆ insert() [1/10]

template<class T, std::size_t N>
template<std::ranges::forward_range Range>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const const_iterator pos,
const Range & range )
inline

inserts a range at the given position

Template Parameters
Rangea generic range that follows the concept std::ranges::forward_range
Parameters
posthe insertion point
rangethe range that should be inserted
Returns
an iterator to the inserted range

◆ insert() [2/10]

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const const_iterator pos,
const std::initializer_list< T > & ilist )
inline

◆ insert() [3/10]

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const const_iterator pos,
const T & value )
inline

Inserts a value.

Parameters
posthe position at which the value should be inserted
valuethe value that the element at that position should have after the insertion
Returns
an iterator pointing to the inserted value

◆ insert() [4/10]

template<class T, std::size_t N>
template<std::forward_iterator Itr>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const const_iterator pos,
Itr first,
Itr last )
inline

inserts a range at a given position

Template Parameters
Itra generic iterator that follows the concept std::forward_iterator
Parameters
posthe position at which should be inserted given by an iterator
firstthe start of the range that should be inserted
lastthe past the end iterator to which should be inserted
Returns
an iterator to the start of the start of the insertion

◆ insert() [5/10]

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const const_iterator pos,
T && value )
inline

Inserts a value.

Parameters
posthe position at which the value should be inserted
valuethe value that the element at that position should have after the insertion
Returns
an iterator pointing to the inserted value

◆ insert() [6/10]

template<class T, std::size_t N>
template<std::integral Int, std::ranges::forward_range Range>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const Int pos,
const Range & range )
inline

inserts the range at the position passed as an integer that wraps if it is a signed type

◆ insert() [7/10]

template<class T, std::size_t N>
template<std::integral Int>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const Int pos,
const std::initializer_list< T > & ilist )
inline

◆ insert() [8/10]

template<class T, std::size_t N>
template<std::integral Int>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const Int pos,
const T & value )
inline

inserts the value at the position passed as an integer that wraps if it is a signed type

◆ insert() [9/10]

template<class T, std::size_t N>
template<std::integral Int, std::forward_iterator Itr>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const Int pos,
Itr first,
Itr last )
inline

inserts the closed-open [first, last) range at the given position

◆ insert() [10/10]

template<class T, std::size_t N>
template<std::integral Int>
iterator fiber::LeftDualArrayListRef< T, N >::insert ( const Int pos,
T && value )
inline

inserts the value at the position passed as an integer that wraps if it is a signed type

◆ max_size()

template<class T, std::size_t N>
size_type fiber::LeftDualArrayListRef< T, N >::max_size ( ) const
inlineconstexpr

returns the maximal number of elements that can be stored in the container

◆ operator!()

template<class T, std::size_t N>
ArrayList< bool, N > fiber::LeftDualArrayListRef< T, N >::operator! ( ) const
inline

Applies the negation (!) operator to all elements and returns it as a bool list.

◆ operator[]() [1/4]

template<class T, std::size_t N>
ArrayList< T, N > fiber::LeftDualArrayListRef< T, N >::operator[] ( const ArrayList< bool, N > & mask) const
inline

accesses all elements where mask is true

◆ operator[]() [2/4]

template<class T, std::size_t N>
template<std::integral Int>
ArrayList< T, N > fiber::LeftDualArrayListRef< T, N >::operator[] ( const ArrayList< Int, N > & indices) const
inline

accesses all elements at the given indices

◆ operator[]() [3/4]

template<class T, std::size_t N>
template<std::integral Int>
T & fiber::LeftDualArrayListRef< T, N >::operator[] ( const Int i)
inlineconstexpr

returns a reference to the element at the given position

◆ operator[]() [4/4]

template<class T, std::size_t N>
template<std::integral Int>
const T & fiber::LeftDualArrayListRef< T, N >::operator[] ( const Int i) const
inlineconstexpr

returns a reference to the element at the given position

◆ pop_back()

template<class T, std::size_t N>
void fiber::LeftDualArrayListRef< T, N >::pop_back ( )
inline

removes and destructs the last element

◆ reserve()

template<class T, std::size_t N>
size_type fiber::LeftDualArrayListRef< T, N >::reserve ( ) const
inlineconstexpr

returns the reserve - number of elements that can be stored until the container is full

◆ size()

template<class T, std::size_t N>
size_type fiber::LeftDualArrayListRef< T, N >::size ( ) const
inlineconstexpr

returns the size/count of live elements in the container

◆ to_const_iterator()

template<class T, std::size_t N>
template<std::integral Int>
const_iterator fiber::LeftDualArrayListRef< T, N >::to_const_iterator ( const Int pos) const
inlineconstexpr

turns the passed unsigned integer into a cosnt_iterator pointing to the same position

◆ to_index()

template<class T, std::size_t N>
size_type fiber::LeftDualArrayListRef< T, N >::to_index ( const const_iterator pos) const
inlineconstexpr

turns the passed position given by an iterator into an integer

◆ to_iterator() [1/2]

template<class T, std::size_t N>
template<std::integral Int>
iterator fiber::LeftDualArrayListRef< T, N >::to_iterator ( const Int pos)
inlineconstexpr

turns the passed unsigned integer into an iterator pointing to the same position

◆ to_iterator() [2/2]

template<class T, std::size_t N>
template<std::integral Int>
const_iterator fiber::LeftDualArrayListRef< T, N >::to_iterator ( const Int pos) const
inlineconstexpr

turns the passed unsigned integer into a cosnt_iterator pointing to the same position

◆ unconst()

template<class T, std::size_t N>
iterator fiber::LeftDualArrayListRef< T, N >::unconst ( const const_iterator pos)
inlineconstexpr

removes the constnes of an iterator if the user has access to the mutable (un-const) container


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