Blender V5.0
blender::iterator::RandomAccessIteratorMixin< Derived > Class Template Reference

#include <BLI_random_access_iterator_mixin.hh>

Public Types

using iterator_category = std::random_access_iterator_tag
using difference_type = std::ptrdiff_t

Public Member Functions

constexpr decltype(auto) operator[] (const std::ptrdiff_t i)
constexpr decltype(auto) operator[] (const std::ptrdiff_t i) const
auto & iter_prop_mutable ()

Friends

constexpr friend Derived & operator++ (Derived &a)
constexpr friend Derived operator++ (Derived &a, int)
constexpr friend Derived & operator-- (Derived &a)
constexpr friend Derived operator-- (Derived &a, int)
constexpr friend Derived & operator+= (Derived &a, const std::ptrdiff_t n)
constexpr friend Derived & operator-= (Derived &a, const std::ptrdiff_t n)
constexpr friend Derived operator+ (const Derived &a, const std::ptrdiff_t n)
constexpr friend Derived operator- (const Derived &a, const std::ptrdiff_t n)
constexpr friend auto operator- (const Derived &a, const Derived &b)
constexpr friend bool operator!= (const Derived &a, const Derived &b)
constexpr friend bool operator== (const Derived &a, const Derived &b)
constexpr friend bool operator< (const Derived &a, const Derived &b)
constexpr friend bool operator> (const Derived &a, const Derived &b)
constexpr friend bool operator<= (const Derived &a, const Derived &b)
constexpr friend bool operator>= (const Derived &a, const Derived &b)

Detailed Description

template<typename Derived>
class blender::iterator::RandomAccessIteratorMixin< Derived >

Simplifies implementing a random-access-iterator.

The actual iterator should derive from this class publicly. Additionally, it has to provide a const iter_prop method which returns a reference to the internal property that corresponds to the current position. This is typically a pointer or an index.

Implementing some random-access-iterator is generally quite simple but requires a lot of boilerplate code because algorithms expect many operators to work on the iterator type. They are expected to behave similarly to pointers and thus have to implement many of the same operators.

Definition at line 27 of file BLI_random_access_iterator_mixin.hh.

Member Typedef Documentation

◆ difference_type

template<typename Derived>
using blender::iterator::RandomAccessIteratorMixin< Derived >::difference_type = std::ptrdiff_t

Definition at line 30 of file BLI_random_access_iterator_mixin.hh.

◆ iterator_category

template<typename Derived>
using blender::iterator::RandomAccessIteratorMixin< Derived >::iterator_category = std::random_access_iterator_tag

Definition at line 29 of file BLI_random_access_iterator_mixin.hh.

Member Function Documentation

◆ iter_prop_mutable()

template<typename Derived>
auto & blender::iterator::RandomAccessIteratorMixin< Derived >::iter_prop_mutable ( )
inline

Definition at line 129 of file BLI_random_access_iterator_mixin.hh.

◆ operator[]() [1/2]

template<typename Derived>
decltype(auto) blender::iterator::RandomAccessIteratorMixin< Derived >::operator[] ( const std::ptrdiff_t i)
inlineconstexpr

Definition at line 119 of file BLI_random_access_iterator_mixin.hh.

References i.

◆ operator[]() [2/2]

template<typename Derived>
decltype(auto) blender::iterator::RandomAccessIteratorMixin< Derived >::operator[] ( const std::ptrdiff_t i) const
inlineconstexpr

Definition at line 124 of file BLI_random_access_iterator_mixin.hh.

References i.

◆ operator!=

template<typename Derived>
friend bool operator!= ( const Derived & a,
const Derived & b )
friend

Definition at line 89 of file BLI_random_access_iterator_mixin.hh.

References b.

◆ operator+

template<typename Derived>
friend Derived operator+ ( const Derived & a,
const std::ptrdiff_t n )
friend

Definition at line 70 of file BLI_random_access_iterator_mixin.hh.

References copy().

◆ operator++ [1/2]

template<typename Derived>
friend Derived & operator++ ( Derived & a)
friend

Definition at line 32 of file BLI_random_access_iterator_mixin.hh.

◆ operator++ [2/2]

template<typename Derived>
friend Derived operator++ ( Derived & a,
int  )
friend

Definition at line 38 of file BLI_random_access_iterator_mixin.hh.

References copy().

◆ operator+=

template<typename Derived>
friend Derived & operator+= ( Derived & a,
const std::ptrdiff_t n )
friend

Definition at line 58 of file BLI_random_access_iterator_mixin.hh.

◆ operator- [1/2]

template<typename Derived>
friend auto operator- ( const Derived & a,
const Derived & b )
friend

Definition at line 84 of file BLI_random_access_iterator_mixin.hh.

References b.

◆ operator- [2/2]

template<typename Derived>
friend Derived operator- ( const Derived & a,
const std::ptrdiff_t n )
friend

Definition at line 77 of file BLI_random_access_iterator_mixin.hh.

References copy().

◆ operator-- [1/2]

template<typename Derived>
friend Derived & operator-- ( Derived & a)
friend

Definition at line 45 of file BLI_random_access_iterator_mixin.hh.

◆ operator-- [2/2]

template<typename Derived>
friend Derived operator-- ( Derived & a,
int  )
friend

Definition at line 51 of file BLI_random_access_iterator_mixin.hh.

References copy().

◆ operator-=

template<typename Derived>
friend Derived & operator-= ( Derived & a,
const std::ptrdiff_t n )
friend

Definition at line 64 of file BLI_random_access_iterator_mixin.hh.

◆ operator<

template<typename Derived>
friend bool operator< ( const Derived & a,
const Derived & b )
friend

Definition at line 99 of file BLI_random_access_iterator_mixin.hh.

References b.

◆ operator<=

template<typename Derived>
friend bool operator<= ( const Derived & a,
const Derived & b )
friend

Definition at line 109 of file BLI_random_access_iterator_mixin.hh.

References b.

◆ operator==

template<typename Derived>
friend bool operator== ( const Derived & a,
const Derived & b )
friend

Definition at line 94 of file BLI_random_access_iterator_mixin.hh.

References b.

◆ operator>

template<typename Derived>
friend bool operator> ( const Derived & a,
const Derived & b )
friend

Definition at line 104 of file BLI_random_access_iterator_mixin.hh.

References b.

◆ operator>=

template<typename Derived>
friend bool operator>= ( const Derived & a,
const Derived & b )
friend

Definition at line 114 of file BLI_random_access_iterator_mixin.hh.

References b.


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