OGS
BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element > Struct Template Reference

Detailed Description

template<typename Element>
struct BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >

Definition at line 25 of file ContainerTools.h.

#include <ContainerTools.h>

Public Types

using value_type = Element
using difference_type = std::ptrdiff_t

Public Member Functions

 PolymorphicRandomAccessContainerViewIterator ()=default
 PolymorphicRandomAccessContainerViewIterator (std::size_t n, PolymorphicRandomAccessContainerViewInterface< Element > const *const view) noexcept
PolymorphicRandomAccessContainerViewIteratoroperator++ () noexcept
PolymorphicRandomAccessContainerViewIterator operator++ (int) noexcept
PolymorphicRandomAccessContainerViewIteratoroperator-- () noexcept
PolymorphicRandomAccessContainerViewIterator operator-- (int) noexcept
PolymorphicRandomAccessContainerViewIteratoroperator+= (difference_type const increment) noexcept
PolymorphicRandomAccessContainerViewIteratoroperator-= (difference_type const decrement) noexcept
difference_type operator- (PolymorphicRandomAccessContainerViewIterator const other) const noexcept
Element & operator* () const
Element & operator[] (difference_type n) const
auto operator<=> (PolymorphicRandomAccessContainerViewIterator const &) const =default

Private Attributes

std::size_t n_ = 0
PolymorphicRandomAccessContainerViewInterface< Element > const * view_

Friends

PolymorphicRandomAccessContainerViewIterator operator+ (PolymorphicRandomAccessContainerViewIterator iterator, difference_type const increment) noexcept
PolymorphicRandomAccessContainerViewIterator operator+ (difference_type const increment, PolymorphicRandomAccessContainerViewIterator iterator) noexcept
PolymorphicRandomAccessContainerViewIterator operator- (PolymorphicRandomAccessContainerViewIterator iterator, difference_type const decrement) noexcept

Member Typedef Documentation

◆ difference_type

template<typename Element>
using BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::difference_type = std::ptrdiff_t

Definition at line 28 of file ContainerTools.h.

◆ value_type

template<typename Element>
using BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::value_type = Element

Definition at line 27 of file ContainerTools.h.

Constructor & Destructor Documentation

◆ PolymorphicRandomAccessContainerViewIterator() [1/2]

template<typename Element>
BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::PolymorphicRandomAccessContainerViewIterator ( )
default

◆ PolymorphicRandomAccessContainerViewIterator() [2/2]

template<typename Element>
BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::PolymorphicRandomAccessContainerViewIterator ( std::size_t n,
PolymorphicRandomAccessContainerViewInterface< Element > const *const view )
inlinenoexcept

Member Function Documentation

◆ operator*()

template<typename Element>
Element & BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator* ( ) const
inlinenodiscard

Definition at line 108 of file ContainerTools.h.

108{ return (*view_)[n_]; }

References n_, and view_.

◆ operator++() [1/2]

template<typename Element>
PolymorphicRandomAccessContainerViewIterator & BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator++ ( )
inlinenoexcept

Definition at line 40 of file ContainerTools.h.

41 {
42 ++n_;
43 return *this;
44 }

References PolymorphicRandomAccessContainerViewIterator(), and n_.

Referenced by operator++().

◆ operator++() [2/2]

template<typename Element>
PolymorphicRandomAccessContainerViewIterator BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator++ ( int )
inlinenoexcept

Definition at line 45 of file ContainerTools.h.

46 {
47 auto copy{*this};
48 operator++();
49 return copy;
50 }
PolymorphicRandomAccessContainerViewIterator & operator++() noexcept

References PolymorphicRandomAccessContainerViewIterator(), and operator++().

◆ operator+=()

template<typename Element>
PolymorphicRandomAccessContainerViewIterator & BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator+= ( difference_type const increment)
inlinenoexcept

Definition at line 64 of file ContainerTools.h.

66 {
67 n_ += increment;
68 return *this;
69 }

References PolymorphicRandomAccessContainerViewIterator(), and n_.

◆ operator-()

template<typename Element>
difference_type BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator- ( PolymorphicRandomAccessContainerViewIterator< Element > const other) const
inlinenodiscardnoexcept

Definition at line 93 of file ContainerTools.h.

95 {
97 return n_ - other.n_;
98 }

References PolymorphicRandomAccessContainerViewIterator(), n_, and view_.

◆ operator--() [1/2]

template<typename Element>
PolymorphicRandomAccessContainerViewIterator & BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator-- ( )
inlinenoexcept

Definition at line 52 of file ContainerTools.h.

53 {
54 --n_;
55 return *this;
56 }

References PolymorphicRandomAccessContainerViewIterator(), and n_.

Referenced by operator--().

◆ operator--() [2/2]

template<typename Element>
PolymorphicRandomAccessContainerViewIterator BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator-- ( int )
inlinenoexcept

Definition at line 57 of file ContainerTools.h.

58 {
59 auto copy{*this};
60 operator--();
61 return copy;
62 }
PolymorphicRandomAccessContainerViewIterator & operator--() noexcept

References PolymorphicRandomAccessContainerViewIterator(), and operator--().

◆ operator-=()

template<typename Element>
PolymorphicRandomAccessContainerViewIterator & BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator-= ( difference_type const decrement)
inlinenoexcept

Definition at line 70 of file ContainerTools.h.

72 {
73 n_ -= decrement;
74 return *this;
75 }

References PolymorphicRandomAccessContainerViewIterator(), and n_.

◆ operator<=>()

template<typename Element>
auto BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator<=> ( PolymorphicRandomAccessContainerViewIterator< Element > const & ) const
default

◆ operator[]()

template<typename Element>
Element & BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::operator[] ( difference_type n) const
inlinenodiscard

Definition at line 109 of file ContainerTools.h.

110 {
111 return (*view_)[n_ + n];
112 }

References n_, and view_.

◆ operator+ [1/2]

template<typename Element>
PolymorphicRandomAccessContainerViewIterator operator+ ( difference_type const increment,
PolymorphicRandomAccessContainerViewIterator< Element > iterator )
friend

Definition at line 85 of file ContainerTools.h.

88 {
90 return iterator;
91 }

References PolymorphicRandomAccessContainerViewIterator().

◆ operator+ [2/2]

template<typename Element>
PolymorphicRandomAccessContainerViewIterator operator+ ( PolymorphicRandomAccessContainerViewIterator< Element > iterator,
difference_type const increment )
friend

Definition at line 77 of file ContainerTools.h.

80 {
82 return iterator;
83 }

References PolymorphicRandomAccessContainerViewIterator().

◆ operator-

template<typename Element>
PolymorphicRandomAccessContainerViewIterator operator- ( PolymorphicRandomAccessContainerViewIterator< Element > iterator,
difference_type const decrement )
friend

Definition at line 100 of file ContainerTools.h.

103 {
105 return iterator;
106 }

References PolymorphicRandomAccessContainerViewIterator().

Member Data Documentation

◆ n_

◆ view_

template<typename Element>
PolymorphicRandomAccessContainerViewInterface<Element> const* BaseLib::detail::PolymorphicRandomAccessContainerViewIterator< Element >::view_
private
Initial value:
=
nullptr

Definition at line 119 of file ContainerTools.h.

Referenced by operator*(), operator-(), and operator[]().


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