jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
Implementation of a Copy-On-Write (CoW) read-onlu iterator over immutable value_type storage. More...
#include <cow_iterator.hpp>
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::const_iterator | iterator_type |
Actual const 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_ro_iterator () noexcept |
constexpr | cow_ro_iterator (const cow_ro_iterator &o) noexcept |
constexpr | cow_ro_iterator (cow_ro_iterator &&o) noexcept |
constexpr iterator_type | base () const noexcept |
Returns a copy of the underlying storage const_iterator. 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 cow_ro_iterator | cbegin () const noexcept |
Returns a new const_iterator pointing to the first element, aka begin. More... | |
constexpr cow_ro_iterator | cend () const noexcept |
Returns a new const_iterator pointing to the element following the last element, aka end. More... | |
constexpr int | compare (const cow_ro_iterator &rhs) const noexcept |
Returns signum or three-way comparison value. More... | |
constexpr int | compare (const cow_rw_iterator< storage_t, storage_ref_t, cow_container_t > &rhs) const noexcept |
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... | |
constexpr difference_type | distance (const cow_rw_iterator< storage_t, storage_ref_t, cow_container_t > &rhs) const noexcept |
constexpr bool | empty () const noexcept |
Returns true if storage is empty(). More... | |
std::string | get_info () const noexcept |
constexpr bool | is_begin () const noexcept |
Returns true, if this iterator points to cbegin(). More... | |
constexpr bool | is_end () const noexcept |
Returns true, if this iterator points to cend(). More... | |
constexpr bool | operator!= (const cow_ro_iterator &rhs) const noexcept |
constexpr const reference | operator* () const noexcept |
constexpr cow_ro_iterator | operator+ (difference_type rhs) const noexcept |
Binary 'iterator + element_count'; Try to avoid: Low performance due to returning copy-ctor. More... | |
constexpr cow_ro_iterator & | operator++ () noexcept |
Pre-increment; Well performing, return *this. More... | |
constexpr cow_ro_iterator | operator++ (int) noexcept |
Post-increment; Try to avoid: Low performance due to returning copy-ctor. More... | |
constexpr cow_ro_iterator & | operator+= (difference_type i) noexcept |
Addition-assignment of 'element_count'; Well performing, return *this. More... | |
constexpr difference_type | operator- (const cow_ro_iterator &rhs) const noexcept |
Binary 'iterator - iterator -> element_count'; Well performing, return element_count of type difference_type. More... | |
constexpr cow_ro_iterator | operator- (difference_type rhs) const noexcept |
Binary 'iterator - element_count'; Try to avoid: Low performance due to returning copy-ctor. More... | |
constexpr cow_ro_iterator & | operator-- () noexcept |
Pre-decrement; Well performing, return *this. More... | |
constexpr cow_ro_iterator | operator-- (int) noexcept |
Post-decrement; Try to avoid: Low performance due to returning copy-ctor. More... | |
constexpr cow_ro_iterator & | operator-= (difference_type i) noexcept |
Subtraction-assignment of 'element_count'; Well performing, return *this. More... | |
constexpr const pointer | operator-> () const noexcept |
constexpr bool | operator< (const cow_ro_iterator &rhs) const noexcept |
constexpr bool | operator<= (const cow_ro_iterator &rhs) const noexcept |
constexpr cow_ro_iterator & | operator= (const cow_ro_iterator &o) noexcept |
constexpr cow_ro_iterator & | operator= (cow_ro_iterator &&o) noexcept |
constexpr bool | operator== (const cow_ro_iterator &rhs) const noexcept |
constexpr bool | operator> (const cow_ro_iterator &rhs) const noexcept |
constexpr bool | operator>= (const cow_ro_iterator &rhs) const noexcept |
constexpr const reference | operator[] (difference_type i) const noexcept |
Subscript of 'element_index', returning immutable Value_type reference. More... | |
constexpr size_type | size () const noexcept |
Return the size of the underlying value_type store. More... | |
constexpr storage_t & | storage () const noexcept |
Returns this instances' underlying shared storage by reference. More... | |
void | swap (cow_ro_iterator &o) noexcept |
constexpr cow_ro_iterator & | to_begin () noexcept |
This iterator is set to the first element, cbegin(). More... | |
constexpr cow_ro_iterator & | to_end () noexcept |
This iterator is set to the last element, cend(). More... | |
std::string | toString () const noexcept |
Friends | |
template<typename , typename , typename , bool , bool > | |
class | cow_darray |
template<typename , typename > | |
class | cow_vector |
Implementation of a Copy-On-Write (CoW) read-onlu iterator over immutable value_type storage.
Instance holds a shared storage snapshot of the parents' CoW storage until destruction.
Implementation complies with Type Traits iterator_category 'random_access_iterator_tag'
Implementation simply wraps the native iterator of type 'iterator_type' and manages the CoW related resource lifecycle.
This iterator is the preferred choice if no mutations are made to the elements state itself, or all changes can be discarded after the iterator's destruction.
This avoids the costly mutex lock and storage copy of jau::cow_rw_iterator.
Also see jau::for_each_fidelity to iterate through in this good faith fashion.
To allow data-race free operations on this iterator's data snapshot from a potentially mutated CoW, only one begin iterator should be retrieved from CoW and all further operations shall use jau::cow_ro_iterator::size(), jau::cow_ro_iterator::begin() and jau::cow_ro_iterator::end().
Definition at line 654 of file cow_iterator.hpp.
typedef Storage_type jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::storage_t |
Definition at line 660 of file cow_iterator.hpp.
typedef Storage_ref_type jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::storage_ref_t |
Definition at line 661 of file cow_iterator.hpp.
typedef CoW_container jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::cow_container_t |
Definition at line 662 of file cow_iterator.hpp.
typedef storage_t::const_iterator jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::iterator_type |
Actual const iterator type of the contained native iterator, probably a simple pointer.
Definition at line 665 of file cow_iterator.hpp.
typedef sub_traits_t::iterator_category jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::iterator_category |
Definition at line 677 of file cow_iterator.hpp.
typedef storage_t::size_type jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::size_type |
Definition at line 679 of file cow_iterator.hpp.
typedef storage_t::difference_type jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::difference_type |
Definition at line 680 of file cow_iterator.hpp.
typedef sub_traits_t::value_type jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::value_type |
Definition at line 684 of file cow_iterator.hpp.
typedef sub_traits_t::reference jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::reference |
Definition at line 685 of file cow_iterator.hpp.
typedef sub_traits_t::pointer jau::cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container >::pointer |
Definition at line 686 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 698 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 711 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 702 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 717 of file cow_iterator.hpp.
|
inlinenoexcept |
Definition at line 727 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns a new const_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.
Definition at line 741 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns a new const_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.
Definition at line 753 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns true if storage is empty().
Definition at line 759 of file cow_iterator.hpp.
|
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 765 of file cow_iterator.hpp.
|
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.
Definition at line 776 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns this instances' underlying shared storage by reference.
Definition at line 781 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns the distance to_end() using zero as first index.
A.k.a the remaining elements iterable.
Definition at line 788 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns true, if this iterator points to cend().
Definition at line 793 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
This iterator is set to the last element, cend().
Returns *this;
Definition at line 798 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns the distance to_begin() using zero as first index.
A.k.a the index from start.
Definition at line 804 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns true, if this iterator points to cbegin().
Definition at line 809 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
This iterator is set to the first element, cbegin().
Returns *this;
Definition at line 814 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Returns a copy of the underlying storage const_iterator.
This is an addition API entry, inspired by the STL std::normal_iterator.
Definition at line 823 of file cow_iterator.hpp.
|
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)
rhs_store | right-hand side store |
rhs_iter | right-hand side iterator |
Definition at line 837 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 842 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 847 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 850 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 855 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 858 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 861 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 864 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 869 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 873 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Post-increment; Try to avoid: Low performance due to returning copy-ctor.
Definition at line 884 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Post-decrement; Try to avoid: Low performance due to returning copy-ctor.
Definition at line 896 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Subscript of 'element_index', returning immutable Value_type reference.
Definition at line 902 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Addition-assignment of 'element_count'; Well performing, return *this.
Definition at line 906 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Binary 'iterator + element_count'; Try to avoid: Low performance due to returning copy-ctor.
Definition at line 910 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Subtraction-assignment of 'element_count'; Well performing, return *this.
Definition at line 914 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Binary 'iterator - element_count'; Try to avoid: Low performance due to returning copy-ctor.
Definition at line 918 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Binary 'iterator - iterator -> element_count'; Well performing, return element_count of type difference_type.
Definition at line 924 of file cow_iterator.hpp.
|
inlineconstexprnoexcept |
Definition at line 927 of file cow_iterator.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 938 of file cow_iterator.hpp.
|
friend |
Definition at line 656 of file cow_iterator.hpp.
|
friend |
Definition at line 657 of file cow_iterator.hpp.