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

Detailed Description

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

Definition at line 18 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 21 of file ContainerTools.h.

◆ value_type

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

Definition at line 20 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 101 of file ContainerTools.h.

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

References n_, and view_.

◆ operator++() [1/2]

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

Definition at line 33 of file ContainerTools.h.

34 {
35 ++n_;
36 return *this;
37 }

References PolymorphicRandomAccessContainerViewIterator(), and n_.

Referenced by operator++().

◆ operator++() [2/2]

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

Definition at line 38 of file ContainerTools.h.

39 {
40 auto copy{*this};
41 operator++();
42 return copy;
43 }
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 57 of file ContainerTools.h.

59 {
60 n_ += increment;
61 return *this;
62 }

References PolymorphicRandomAccessContainerViewIterator(), and n_.

◆ operator-()

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

Definition at line 86 of file ContainerTools.h.

88 {
90 return n_ - other.n_;
91 }

References PolymorphicRandomAccessContainerViewIterator(), n_, and view_.

◆ operator--() [1/2]

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

Definition at line 45 of file ContainerTools.h.

46 {
47 --n_;
48 return *this;
49 }

References PolymorphicRandomAccessContainerViewIterator(), and n_.

Referenced by operator--().

◆ operator--() [2/2]

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

Definition at line 50 of file ContainerTools.h.

51 {
52 auto copy{*this};
53 operator--();
54 return copy;
55 }
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 63 of file ContainerTools.h.

65 {
66 n_ -= decrement;
67 return *this;
68 }

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 102 of file ContainerTools.h.

103 {
104 return (*view_)[n_ + n];
105 }

References n_, and view_.

◆ operator+ [1/2]

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

Definition at line 78 of file ContainerTools.h.

81 {
83 return iterator;
84 }

References PolymorphicRandomAccessContainerViewIterator().

◆ operator+ [2/2]

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

Definition at line 70 of file ContainerTools.h.

73 {
75 return iterator;
76 }

References PolymorphicRandomAccessContainerViewIterator().

◆ operator-

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

Definition at line 93 of file ContainerTools.h.

96 {
98 return iterator;
99 }

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 112 of file ContainerTools.h.

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


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