StrideIndexer< IntType > Class Template Reference

Indexer or generator for strided integral values. The extended base functionality (eg, prev, next) allows its reuse for StrideIterator etc. More...

Inheritance diagram for StrideIndexer< IntType >:

Public Types

typedef IntType value_type
 
typedef IntType difference_type
 

Public Member Functions

constexpr StrideIndexer () noexcept
 Default construct as zero, stride=1. More...
 
constexpr StrideIndexer (value_type stride) noexcept
 Construct with value zero and specified stride. No checks (ie, possible to have a 0 stride!) More...
 
constexpr StrideIndexer (value_type start, value_type stride) noexcept
 Construct with specified value and stride. No checks (ie, possible to have a 0 stride!) More...
 
constexpr value_type value () const noexcept
 The current value. More...
 
constexpr value_type stride () const noexcept
 The stride. More...
 
constexpr value_type value (value_type n) const noexcept
 Return the value offset by n strides. More...
 
void prev () noexcept
 Decrement the value by the stride. More...
 
void next () noexcept
 Increment the value by the stride. More...
 
void prev (value_type n) noexcept
 Decrease value by n strides. More...
 
void next (value_type n) noexcept
 Increase value by n strides. More...
 
constexpr value_type operator* () const noexcept
 Return the value. More...
 
value_type operator() () noexcept
 Apply a postfix increment and return the current value. More...
 

Detailed Description

template<class IntType>
class Foam::StrideIndexer< IntType >

Indexer or generator for strided integral values. The extended base functionality (eg, prev, next) allows its reuse for StrideIterator etc.

Definition at line 61 of file StrideIterator.H.

Member Typedef Documentation

◆ value_type

typedef IntType value_type

Definition at line 80 of file StrideIterator.H.

◆ difference_type

typedef IntType difference_type

Definition at line 81 of file StrideIterator.H.

Constructor & Destructor Documentation

◆ StrideIndexer() [1/3]

constexpr StrideIndexer ( )
inlinenoexcept

Default construct as zero, stride=1.

Definition at line 89 of file StrideIterator.H.

◆ StrideIndexer() [2/3]

constexpr StrideIndexer ( value_type  stride)
inlinenoexcept

Construct with value zero and specified stride. No checks (ie, possible to have a 0 stride!)

Definition at line 98 of file StrideIterator.H.

◆ StrideIndexer() [3/3]

constexpr StrideIndexer ( value_type  start,
value_type  stride 
)
inlinenoexcept

Construct with specified value and stride. No checks (ie, possible to have a 0 stride!)

Definition at line 107 of file StrideIterator.H.

Member Function Documentation

◆ value() [1/2]

◆ stride()

constexpr value_type stride ( ) const
inlinenoexcept

◆ value() [2/2]

constexpr value_type value ( value_type  n) const
inlinenoexcept

Return the value offset by n strides.

Definition at line 128 of file StrideIterator.H.

References n.

◆ prev() [1/2]

void prev ( )
inlinenoexcept

Decrement the value by the stride.

Definition at line 136 of file StrideIterator.H.

Referenced by RevStrideIterator< IntType >::operator++(), RevStrideIterator< IntType >::operator+=(), StrideIterator< IntType >::operator--(), and StrideIterator< IntType >::operator-=().

Here is the caller graph for this function:

◆ next() [1/2]

void next ( )
inlinenoexcept

◆ prev() [2/2]

void prev ( value_type  n)
inlinenoexcept

Decrease value by n strides.

Definition at line 146 of file StrideIterator.H.

References n.

◆ next() [2/2]

void next ( value_type  n)
inlinenoexcept

Increase value by n strides.

Definition at line 151 of file StrideIterator.H.

References n.

◆ operator*()

constexpr value_type operator* ( ) const
inlinenoexcept

Return the value.

Definition at line 159 of file StrideIterator.H.

◆ operator()()

value_type operator() ( )
inlinenoexcept

Apply a postfix increment and return the current value.

This operator definition is required for a generator - see std::generate()

Definition at line 167 of file StrideIterator.H.

References StrideIndexer< IntType >::next().

Here is the call graph for this function:

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