jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Types | Public Member Functions | Friends | List of all members
jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > Class Template Reference

Implementation of a Copy-On-Write (CoW) read-write iterator over mutable value_type storage. More...

#include <cow_iterator.hpp>

Collaboration diagram for jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >:

Public Types

typedef CoW_container cow_container_t
 
typedef storage_t::difference_type difference_type
 
typedef sub_traits_t::iterator_category iterator_category
 
typedef storage_t::iterator iterator_type
 Actual iterator type of the contained native iterator, probably a simple pointer. More...
 
typedef sub_traits_t::pointer pointer
 
typedef sub_traits_t::reference reference
 
typedef storage_t::size_type size_type
 
typedef Storage_ref_type storage_ref_t
 
typedef Storage_type storage_t
 
typedef sub_traits_t::value_type value_type
 

Public Member Functions

constexpr cow_rw_iterator (const cow_rw_iterator &o) noexcept
 C++ named requirements: LegacyIterator: CopyConstructible. More...
 
constexpr cow_rw_iterator (cow_rw_iterator &&o) noexcept
 C++ named requirements: LegacyIterator: MoveConstructable. More...
 
constexpr iterator_type base () const noexcept
 Returns a copy of the underlying storage iterator. More...
 
constexpr cow_rw_iterator begin () const noexcept
 Returns a new iterator pointing to the first element, aka begin. More...
 
constexpr bool capacity_reached () const noexcept
 Returns true if storage capacity has been reached and the next push_back() will grow the storage and invalidates all iterators and references. More...
 
constexpr int compare (const cow_rw_iterator &rhs) const noexcept
 Returns signum or three-way comparison value. More...
 
constexpr difference_type dist_begin () const noexcept
 Returns the distance to_begin() using zero as first index. More...
 
constexpr difference_type dist_end () const noexcept
 Returns the distance to_end() using zero as first index. More...
 
template<typename... Args>
constexpr void emplace (Args &&... args)
 Like std::vector::emplace(), construct a new element in place. More...
 
template<typename... Args>
constexpr reference emplace_back (Args &&... args)
 Like std::vector::emplace_back(), construct a new element in place at the end(). More...
 
constexpr bool empty () const noexcept
 Returns true if storage is empty(). More...
 
constexpr cow_rw_iterator end () const noexcept
 Returns a new iterator pointing to the element following the last element, aka end. More...
 
constexpr void erase ()
 Erases the element at the current position. More...
 
constexpr void erase (size_type count)
 Like std::vector::erase(), removes the elements in the range [current, current+count). More...
 
std::string get_info () const noexcept
 
constexpr cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > immutable () const noexcept
 Returns a new const_iterator pointing to the current position. More...
 
constexpr void insert (const value_type &x)
 Inserts the element before the current position and moves all elements from there to the right beforehand. More...
 
template<class InputIt >
constexpr void insert (InputIt first, InputIt last)
 Like std::vector::insert(), inserting the value_type range [first, last). More...
 
constexpr void insert (value_type &&x)
 Inserts the element before the current position (std::move operation) and moves all elements from there to the right beforehand. More...
 
constexpr bool is_begin () const noexcept
 Returns true, if this iterator points to begin(). More...
 
constexpr bool is_end () const noexcept
 Returns true, if this iterator points to end(). More...
 
constexpr bool operator!= (const cow_rw_iterator &rhs) const noexcept
 
constexpr const reference operator* () const noexcept
 Dereferencing iterator to value_type reference. More...
 
constexpr reference operator* () noexcept
 Dereferencing iterator to value_type reference. More...
 
constexpr cow_rw_iterator operator+ (difference_type rhs) const noexcept
 Binary 'iterator + element_count'; Try to avoid: Low performance due to returning copy-ctor. More...
 
constexpr cow_rw_iteratoroperator++ () noexcept
 Pre-increment; Well performing, return *this. More...
 
constexpr cow_rw_iterator operator++ (int) noexcept
 Post-increment; Try to avoid: Low performance due to returning copy-ctor. More...
 
constexpr cow_rw_iteratoroperator+= (difference_type i) noexcept
 Addition-assignment of 'element_count'; Well performing, return *this. More...
 
constexpr difference_type operator- (const cow_rw_iterator &rhs) const noexcept
 Binary 'iterator - iterator -> element_count'; Well performing, return element_count of type difference_type. More...
 
constexpr cow_rw_iterator operator- (difference_type rhs) const noexcept
 Binary 'iterator - element_count'; Try to avoid: Low performance due to returning copy-ctor. More...
 
constexpr cow_rw_iteratoroperator-- () noexcept
 Pre-decrement; Well performing, return *this. More...
 
constexpr cow_rw_iterator operator-- (int) noexcept
 Post-decrement; Try to avoid: Low performance due to returning copy-ctor. More...
 
constexpr cow_rw_iteratoroperator-= (difference_type i) noexcept
 Subtraction-assignment of 'element_count'; Well performing, return *this. More...
 
constexpr const pointer operator-> () const noexcept
 Pointer to member access. More...
 
constexpr pointer operator-> () noexcept
 Pointer to member access. More...
 
constexpr bool operator< (const cow_rw_iterator &rhs) const noexcept
 
constexpr bool operator<= (const cow_rw_iterator &rhs) const noexcept
 
constexpr cow_rw_iteratoroperator= (const cow_rw_iterator &o) noexcept
 Assigns content of other mutable iterator to this one, if they are not identical. More...
 
constexpr cow_rw_iteratoroperator= (cow_rw_iterator &&o) noexcept
 Assigns identity of given mutable iterator, if they are not identical. More...
 
constexpr bool operator== (const cow_rw_iterator &rhs) const noexcept
 
constexpr bool operator> (const cow_rw_iterator &rhs) const noexcept
 
constexpr bool operator>= (const cow_rw_iterator &rhs) const noexcept
 
constexpr const reference operator[] (difference_type i) const noexcept
 Subscript of 'element_index', returning immutable Value_type reference. More...
 
constexpr reference operator[] (difference_type i) noexcept
 Subscript of 'element_index', returning mutable Value_type reference. More...
 
constexpr void pop_back () noexcept
 Removes the last element and sets this iterator to end() More...
 
constexpr void push_back (const value_type &x)
 Like std::vector::push_back(), copy. More...
 
template<class InputIt >
constexpr void push_back (InputIt first, InputIt last)
 Like std::vector::push_back(), but appends the value_type range [first, last). More...
 
constexpr void push_back (value_type &&x)
 Like std::vector::push_back(), move. More...
 
constexpr size_type size () const noexcept
 Return the size of the underlying value_type store. More...
 
constexpr storage_tstorage () const noexcept
 Returns this instances' underlying shared storage by reference. More...
 
void swap (cow_rw_iterator &o) noexcept
 C++ named requirements: LegacyIterator: Swappable. More...
 
constexpr cow_rw_iteratorto_begin () noexcept
 This iterator is set to the first element, begin(). More...
 
constexpr cow_rw_iteratorto_end () noexcept
 This iterator is set to the last element, end(). More...
 
std::string toString () const noexcept
 
void write_back () noexcept
 Replace the parent's current store with this iterators' instance, unlock the CoW parents' write lock and discard all storage references. More...
 

Friends

template<typename , typename , typename , bool , bool >
class cow_darray
 
template<typename , typename >
class cow_vector
 

Detailed Description

template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
class jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >

Implementation of a Copy-On-Write (CoW) read-write iterator over mutable value_type storage.


Instance holds a copy of the parents' CoW storage and locks its write mutex until write_back() or destruction.

Implementation complies with Type Traits iterator_category 'random_access_iterator_tag'

This iterator wraps the native iterator of type 'iterator_type' and manages the CoW related resource lifecycle.

After completing all mutable operations but before this iterator's destruction, the user might want to write back this iterators' storage to its parents' CoW using write_back()

Due to the costly nature of mutable CoW resource management, consider using jau::cow_ro_iterator if elements won't get mutated or any changes can be discarded.

To allow data-race free operations on this iterator's data copy from a potentially mutated CoW, only one begin iterator should be retrieved from CoW and all further operations shall use jau::cow_rw_iterator::size(), jau::cow_rw_iterator::begin() and jau::cow_rw_iterator::end().

See also
jau::cow_rw_iterator::write_back()
jau::for_each_fidelity
jau::cow_darray

Definition at line 86 of file cow_iterator.hpp.

Member Typedef Documentation

◆ storage_t

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef Storage_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::storage_t

Definition at line 92 of file cow_iterator.hpp.

◆ storage_ref_t

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef Storage_ref_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::storage_ref_t

Definition at line 93 of file cow_iterator.hpp.

◆ cow_container_t

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef CoW_container jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::cow_container_t

Definition at line 94 of file cow_iterator.hpp.

◆ iterator_type

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef storage_t::iterator jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::iterator_type

Actual iterator type of the contained native iterator, probably a simple pointer.

Definition at line 97 of file cow_iterator.hpp.

◆ iterator_category

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef sub_traits_t::iterator_category jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::iterator_category

Definition at line 116 of file cow_iterator.hpp.

◆ size_type

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef storage_t::size_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::size_type

Definition at line 118 of file cow_iterator.hpp.

◆ difference_type

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef storage_t::difference_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::difference_type

Definition at line 119 of file cow_iterator.hpp.

◆ value_type

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef sub_traits_t::value_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::value_type

Definition at line 123 of file cow_iterator.hpp.

◆ reference

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef sub_traits_t::reference jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::reference

Definition at line 124 of file cow_iterator.hpp.

◆ pointer

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
typedef sub_traits_t::pointer jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::pointer

Definition at line 125 of file cow_iterator.hpp.

Constructor & Destructor Documentation

◆ cow_rw_iterator() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::cow_rw_iterator ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  o)
inlineconstexprnoexcept

C++ named requirements: LegacyIterator: CopyConstructible.

Definition at line 169 of file cow_iterator.hpp.

◆ cow_rw_iterator() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::cow_rw_iterator ( cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &&  o)
inlineconstexprnoexcept

C++ named requirements: LegacyIterator: MoveConstructable.

Definition at line 196 of file cow_iterator.hpp.

Member Function Documentation

◆ write_back()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::write_back ( )
inlinenoexcept

Replace the parent's current store with this iterators' instance, unlock the CoW parents' write lock and discard all storage references.

After calling write_back(), this iterator is invalidated and no more operational.

It is the user's responsibility to issue call this method to update the CoW parents' storage.

It is not feasible nor effective to automatically earmark a dirty state on mutable operations.
This is due to the ambiguous semantics of like operator*().
Also usage of multiple iterators to one CoW instance during a mutable operation complicates such an automated task, especially as we wish to only realize one storage replacement at the end.
Lastly, the user probably wants to issue the CoW storage sync in a programmatic deterministic fashion at the end.

See also
jau::cow_darray::set_store()

Definition at line 156 of file cow_iterator.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator= ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  o)
inlineconstexprnoexcept

Assigns content of other mutable iterator to this one, if they are not identical.

C++ named requirements: LegacyIterator: CopyAssignable

Parameters
othe new identity value to be copied into this iterator
Returns
reference to this

Definition at line 182 of file cow_iterator.hpp.

◆ operator=() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator= ( cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &&  o)
inlineconstexprnoexcept

Assigns identity of given mutable iterator, if they are not identical.

C++ named requirements: LegacyIterator: MoveAssignable

Parameters
othe new identity to be taken
Returns
reference to this

Definition at line 212 of file cow_iterator.hpp.

◆ swap()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::swap ( cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  o)
inlinenoexcept

C++ named requirements: LegacyIterator: Swappable.

Definition at line 226 of file cow_iterator.hpp.

◆ immutable()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::immutable ( ) const
inlineconstexprnoexcept

Returns a new const_iterator pointing to the current position.


This is the only explicit conversion operation of mutable -> immutable iterator, see below.

Be aware that the resulting cow_ro_iterator points to transient storage of this immutable iterator. In case write_back() won't be called and this iterator destructs, the returned immutable iterator is invalidated.

See also
size()
end()

Definition at line 244 of file cow_iterator.hpp.

◆ begin()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::begin ( ) const
inlineconstexprnoexcept

Returns a new iterator pointing to the first element, aka begin.

This is an addition API entry, allowing data-race free operations on this iterator's data snapshot from a potentially mutated CoW.

See also
size()
end()

Definition at line 256 of file cow_iterator.hpp.

Here is the caller graph for this function:

◆ end()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::end ( ) const
inlineconstexprnoexcept

Returns a new iterator pointing to the element following the last element, aka end.


This is an addition API entry, allowing data-race free operations on this iterator's data snapshot from a potentially mutated CoW.

See also
size()
begin()

Definition at line 268 of file cow_iterator.hpp.

Here is the caller graph for this function:

◆ empty()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::empty ( ) const
inlineconstexprnoexcept

Returns true if storage is empty().

Definition at line 274 of file cow_iterator.hpp.

◆ capacity_reached()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::capacity_reached ( ) const
inlineconstexprnoexcept

Returns true if storage capacity has been reached and the next push_back() will grow the storage and invalidates all iterators and references.

Definition at line 280 of file cow_iterator.hpp.

◆ size()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr size_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::size ( ) const
inlineconstexprnoexcept

Return the size of the underlying value_type store.

This is an addition API entry, allowing data-race free arithmetic on this iterator's data snapshot from a potentially mutated CoW.

See also
begin()
end()

Definition at line 291 of file cow_iterator.hpp.

◆ storage()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr storage_t & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::storage ( ) const
inlineconstexprnoexcept

Returns this instances' underlying shared storage by reference.

Definition at line 296 of file cow_iterator.hpp.

◆ dist_end()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr difference_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::dist_end ( ) const
inlineconstexprnoexcept

Returns the distance to_end() using zero as first index.

A.k.a the remaining elements iterable.

Definition at line 303 of file cow_iterator.hpp.

◆ is_end()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::is_end ( ) const
inlineconstexprnoexcept

Returns true, if this iterator points to end().

Definition at line 308 of file cow_iterator.hpp.

Here is the caller graph for this function:

◆ to_end()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::to_end ( )
inlineconstexprnoexcept

This iterator is set to the last element, end().

Returns *this;

Definition at line 313 of file cow_iterator.hpp.

◆ dist_begin()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr difference_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::dist_begin ( ) const
inlineconstexprnoexcept

Returns the distance to_begin() using zero as first index.

A.k.a the index from start.

Definition at line 319 of file cow_iterator.hpp.

◆ is_begin()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::is_begin ( ) const
inlineconstexprnoexcept

Returns true, if this iterator points to begin().

Definition at line 324 of file cow_iterator.hpp.

◆ to_begin()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::to_begin ( )
inlineconstexprnoexcept

This iterator is set to the first element, begin().

Returns *this;

Definition at line 329 of file cow_iterator.hpp.

◆ base()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr iterator_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::base ( ) const
inlineconstexprnoexcept

Returns a copy of the underlying storage iterator.

Definition at line 335 of file cow_iterator.hpp.

◆ compare()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr int jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::compare ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Returns signum or three-way comparison value.

   0 if equal (both, store and iteratore),
  -1 if this->iterator_ < rhs_iter and
   1 if this->iterator_ > rhs_iter (otherwise)
Parameters
rhs_storeright-hand side store
rhs_iterright-hand side iterator

Definition at line 349 of file cow_iterator.hpp.

Here is the caller graph for this function:

◆ operator==()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator== ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Definition at line 354 of file cow_iterator.hpp.

◆ operator!=()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator!= ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Definition at line 357 of file cow_iterator.hpp.

◆ operator<=()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator<= ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Definition at line 362 of file cow_iterator.hpp.

◆ operator<()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator< ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Definition at line 365 of file cow_iterator.hpp.

◆ operator>=()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator>= ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Definition at line 368 of file cow_iterator.hpp.

◆ operator>()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr bool jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator> ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Definition at line 371 of file cow_iterator.hpp.

◆ operator*() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr const reference jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator* ( ) const
inlineconstexprnoexcept

Dereferencing iterator to value_type reference.

Returns
immutable reference to value_type

Definition at line 380 of file cow_iterator.hpp.

◆ operator->() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr const pointer jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator-> ( ) const
inlineconstexprnoexcept

Pointer to member access.

Returns
immutable pointer to value_type

Definition at line 388 of file cow_iterator.hpp.

◆ operator*() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr reference jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator* ( )
inlineconstexprnoexcept

Dereferencing iterator to value_type reference.

Returns
mutable reference to value_type

Definition at line 396 of file cow_iterator.hpp.

◆ operator->() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr pointer jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator-> ( )
inlineconstexprnoexcept

Pointer to member access.

Returns
mutable pointer to value_type

Definition at line 402 of file cow_iterator.hpp.

◆ operator++() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator++ ( )
inlineconstexprnoexcept

Pre-increment; Well performing, return *this.


Definition at line 407 of file cow_iterator.hpp.

◆ operator++() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator++ ( int  )
inlineconstexprnoexcept

Post-increment; Try to avoid: Low performance due to returning copy-ctor.

Definition at line 413 of file cow_iterator.hpp.

◆ operator--() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator-- ( )
inlineconstexprnoexcept

Pre-decrement; Well performing, return *this.


Definition at line 419 of file cow_iterator.hpp.

◆ operator--() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator-- ( int  )
inlineconstexprnoexcept

Post-decrement; Try to avoid: Low performance due to returning copy-ctor.

Definition at line 425 of file cow_iterator.hpp.

◆ operator[]() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr const reference jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator[] ( difference_type  i) const
inlineconstexprnoexcept

Subscript of 'element_index', returning immutable Value_type reference.

Definition at line 431 of file cow_iterator.hpp.

◆ operator[]() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr reference jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator[] ( difference_type  i)
inlineconstexprnoexcept

Subscript of 'element_index', returning mutable Value_type reference.

Definition at line 437 of file cow_iterator.hpp.

◆ operator+=()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator+= ( difference_type  i)
inlineconstexprnoexcept

Addition-assignment of 'element_count'; Well performing, return *this.


Definition at line 442 of file cow_iterator.hpp.

◆ operator+()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator+ ( difference_type  rhs) const
inlineconstexprnoexcept

Binary 'iterator + element_count'; Try to avoid: Low performance due to returning copy-ctor.

Definition at line 446 of file cow_iterator.hpp.

◆ operator-=()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator & jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator-= ( difference_type  i)
inlineconstexprnoexcept

Subtraction-assignment of 'element_count'; Well performing, return *this.


Definition at line 450 of file cow_iterator.hpp.

◆ operator-() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr cow_rw_iterator jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator- ( difference_type  rhs) const
inlineconstexprnoexcept

Binary 'iterator - element_count'; Try to avoid: Low performance due to returning copy-ctor.

Definition at line 454 of file cow_iterator.hpp.

◆ operator-() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr difference_type jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::operator- ( const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &  rhs) const
inlineconstexprnoexcept

Binary 'iterator - iterator -> element_count'; Well performing, return element_count of type difference_type.

Definition at line 460 of file cow_iterator.hpp.

◆ toString()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
std::string jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::toString ( ) const
inlinenoexcept

Definition at line 463 of file cow_iterator.hpp.

Here is the caller graph for this function:

◆ get_info()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
std::string jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::get_info ( ) const
inlinenoexcept

Definition at line 471 of file cow_iterator.hpp.

◆ pop_back()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::pop_back ( )
inlineconstexprnoexcept

Removes the last element and sets this iterator to end()

Definition at line 480 of file cow_iterator.hpp.

◆ erase() [1/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::erase ( )
inlineconstexpr

Erases the element at the current position.

This iterator is set to the element following the last removed element.

Definition at line 491 of file cow_iterator.hpp.

Here is the caller graph for this function:

◆ erase() [2/2]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::erase ( size_type  count)
inlineconstexpr

Like std::vector::erase(), removes the elements in the range [current, current+count).

This iterator is set to the element following the last removed element.

Definition at line 501 of file cow_iterator.hpp.

◆ insert() [1/3]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::insert ( const value_type x)
inlineconstexpr

Inserts the element before the current position and moves all elements from there to the right beforehand.

size will be increased by one.

This iterator is set to the inserted element.

Definition at line 515 of file cow_iterator.hpp.

◆ insert() [2/3]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::insert ( value_type &&  x)
inlineconstexpr

Inserts the element before the current position (std::move operation) and moves all elements from there to the right beforehand.

size will be increased by one.

This iterator is set to the inserted element.

Definition at line 529 of file cow_iterator.hpp.

◆ emplace()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
template<typename... Args>
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::emplace ( Args &&...  args)
inlineconstexpr

Like std::vector::emplace(), construct a new element in place.

Constructs the element before the current position using placement new and moves all elements from there to the right beforehand.

size will be increased by one.

This iterator is set to the inserted element.

Parameters
argsarguments to forward to the constructor of the element

Definition at line 548 of file cow_iterator.hpp.

◆ insert() [3/3]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
template<class InputIt >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::insert ( InputIt  first,
InputIt  last 
)
inlineconstexpr

Like std::vector::insert(), inserting the value_type range [first, last).

This iterator is set to the first element inserted, or pos if first==last.

Template Parameters
InputItforeign input-iterator to range of value_type [first, last)
Parameters
firstfirst foreign input-iterator to range of value_type [first, last)
lastlast foreign input-iterator to range of value_type [first, last)

Definition at line 562 of file cow_iterator.hpp.

◆ push_back() [1/3]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::push_back ( const value_type x)
inlineconstexpr

Like std::vector::push_back(), copy.

This iterator is set to the end.

Parameters
xthe value to be added at the tail.

Definition at line 573 of file cow_iterator.hpp.

◆ push_back() [2/3]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::push_back ( value_type &&  x)
inlineconstexpr

Like std::vector::push_back(), move.

This iterator is set to the end.

Parameters
xthe value to be added at the tail.

Definition at line 585 of file cow_iterator.hpp.

◆ emplace_back()

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
template<typename... Args>
constexpr reference jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::emplace_back ( Args &&...  args)
inlineconstexpr

Like std::vector::emplace_back(), construct a new element in place at the end().

Constructs the element at the end() using placement new.

size will be increased by one.

This iterator is set to the end.

Parameters
argsarguments to forward to the constructor of the element

Definition at line 604 of file cow_iterator.hpp.

◆ push_back() [3/3]

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
template<class InputIt >
constexpr void jau::cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container >::push_back ( InputIt  first,
InputIt  last 
)
inlineconstexpr

Like std::vector::push_back(), but appends the value_type range [first, last).

This iterator is set to the end.

Template Parameters
InputItforeign input-iterator to range of value_type [first, last)
Parameters
firstfirst foreign input-iterator to range of value_type [first, last)
lastlast foreign input-iterator to range of value_type [first, last)

Definition at line 620 of file cow_iterator.hpp.

Friends And Related Function Documentation

◆ cow_darray

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
template<typename , typename , typename , bool , bool >
friend class cow_darray
friend

Definition at line 88 of file cow_iterator.hpp.

◆ cow_vector

template<typename Storage_type , typename Storage_ref_type , typename CoW_container >
template<typename , typename >
friend class cow_vector
friend

Definition at line 89 of file cow_iterator.hpp.


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