QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | Friends | Related Functions | List of all members
step_iterator< Iterator > Class Template Reference

Iterator advancing in constant steps. More...

#include <steppingiterator.hpp>

+ Collaboration diagram for step_iterator< Iterator >:

Public Types

using iterator_category = typename std::iterator_traits< Iterator >::iterator_category
 
using difference_type = typename std::iterator_traits< Iterator >::difference_type
 
using value_type = typename std::iterator_traits< Iterator >::value_type
 
using pointer = typename std::iterator_traits< Iterator >::pointer
 
using reference = typename std::iterator_traits< Iterator >::reference
 

Public Member Functions

 step_iterator ()=default
 
 step_iterator (const Iterator &base, Size step)
 
template<class OtherIterator >
 step_iterator (const step_iterator< OtherIterator > &i, std::enable_if_t< std::is_convertible< OtherIterator, Iterator >::value > *=nullptr)
 
Size step () const
 
Iterator base () const
 
void increment ()
 
void decrement ()
 
void advance (typename std::iterator_traits< Iterator >::difference_type n)
 
std::iterator_traits< Iterator >::difference_type distance_to (const step_iterator &i) const
 
step_iteratoroperator= (const step_iterator &other)
 
step_iteratoroperator++ ()
 
step_iterator operator++ (int)
 
reference operator* () const
 
step_iteratoroperator-- ()
 
step_iterator operator-- (int)
 
step_iteratoroperator+= (Size n)
 
step_iteratoroperator-= (Size n)
 
reference operator[] (Size n) const
 

Private Attributes

Iterator base_ {}
 
BigInteger step_ {}
 

Friends

step_iterator operator+ (const step_iterator &i, Size n)
 
step_iterator operator+ (Size n, const step_iterator &i)
 
step_iterator operator- (const step_iterator &i, Size n)
 
difference_type operator- (const step_iterator &lhs, const step_iterator &rhs)
 
bool operator== (const step_iterator &lhs, const step_iterator &rhs)
 
bool operator!= (const step_iterator &lhs, const step_iterator &rhs)
 
bool operator< (const step_iterator &lhs, const step_iterator &rhs)
 
bool operator> (const step_iterator &lhs, const step_iterator &rhs)
 
bool operator<= (const step_iterator &lhs, const step_iterator &rhs)
 
bool operator>= (const step_iterator &lhs, const step_iterator &rhs)
 

Related Functions

(Note that these are not member functions.)

template<class Iterator >
step_iterator< Iterator > make_step_iterator (Iterator it, Size step)
 helper function to create step iterators More...
 

Detailed Description

template<class Iterator>
class QuantLib::step_iterator< Iterator >

Iterator advancing in constant steps.

This iterator advances an underlying random-access iterator in steps of \( n \) positions, where \( n \) is a positive integer given upon construction.

Definition at line 44 of file steppingiterator.hpp.

Member Typedef Documentation

◆ iterator_category

using iterator_category = typename std::iterator_traits<Iterator>::iterator_category

Definition at line 51 of file steppingiterator.hpp.

◆ difference_type

using difference_type = typename std::iterator_traits<Iterator>::difference_type

Definition at line 52 of file steppingiterator.hpp.

◆ value_type

using value_type = typename std::iterator_traits<Iterator>::value_type

Definition at line 53 of file steppingiterator.hpp.

◆ pointer

using pointer = typename std::iterator_traits<Iterator>::pointer

Definition at line 54 of file steppingiterator.hpp.

◆ reference

using reference = typename std::iterator_traits<Iterator>::reference

Definition at line 55 of file steppingiterator.hpp.

Constructor & Destructor Documentation

◆ step_iterator() [1/3]

step_iterator ( )
default

◆ step_iterator() [2/3]

step_iterator ( const Iterator &  base,
Size  step 
)
explicit

Definition at line 59 of file steppingiterator.hpp.

◆ step_iterator() [3/3]

step_iterator ( const step_iterator< OtherIterator > &  i,
std::enable_if_t< std::is_convertible< OtherIterator, Iterator >::value > *  = nullptr 
)

Definition at line 63 of file steppingiterator.hpp.

Member Function Documentation

◆ step()

Size step ( ) const

Definition at line 69 of file steppingiterator.hpp.

◆ base()

Iterator base ( ) const
Deprecated:
This class no longer inherits from boost::iterator_adaptor`. Deprecated in version 1.31.

Definition at line 75 of file steppingiterator.hpp.

◆ increment()

void increment ( )
Deprecated:
This class no longer inherits from boost::iterator_adaptor`. Deprecated in version 1.31.

Definition at line 81 of file steppingiterator.hpp.

◆ decrement()

void decrement ( )
Deprecated:
This class no longer inherits from boost::iterator_adaptor`. Deprecated in version 1.31.

Definition at line 89 of file steppingiterator.hpp.

◆ advance()

void advance ( typename std::iterator_traits< Iterator >::difference_type  n)
Deprecated:
This class no longer inherits from boost::iterator_adaptor`. Deprecated in version 1.31.

Definition at line 97 of file steppingiterator.hpp.

◆ distance_to()

std::iterator_traits< Iterator >::difference_type distance_to ( const step_iterator< Iterator > &  i) const
Deprecated:
This class no longer inherits from boost::iterator_adaptor`. Deprecated in version 1.31.

Definition at line 106 of file steppingiterator.hpp.

◆ operator=()

step_iterator & operator= ( const step_iterator< Iterator > &  other)

Definition at line 110 of file steppingiterator.hpp.

◆ operator++() [1/2]

step_iterator & operator++ ( )

Definition at line 116 of file steppingiterator.hpp.

◆ operator++() [2/2]

step_iterator operator++ ( int  )

Definition at line 121 of file steppingiterator.hpp.

◆ operator*()

reference operator* ( ) const

Definition at line 127 of file steppingiterator.hpp.

◆ operator--() [1/2]

step_iterator & operator-- ( )

Definition at line 131 of file steppingiterator.hpp.

◆ operator--() [2/2]

step_iterator operator-- ( int  )

Definition at line 136 of file steppingiterator.hpp.

◆ operator+=()

step_iterator & operator+= ( Size  n)

Definition at line 142 of file steppingiterator.hpp.

◆ operator-=()

step_iterator & operator-= ( Size  n)

Definition at line 147 of file steppingiterator.hpp.

◆ operator[]()

reference operator[] ( Size  n) const

Definition at line 152 of file steppingiterator.hpp.

Friends And Related Function Documentation

◆ operator+ [1/2]

step_iterator operator+ ( const step_iterator< Iterator > &  i,
Size  n 
)
friend

Definition at line 156 of file steppingiterator.hpp.

◆ operator+ [2/2]

step_iterator operator+ ( Size  n,
const step_iterator< Iterator > &  i 
)
friend

Definition at line 160 of file steppingiterator.hpp.

◆ operator- [1/2]

step_iterator operator- ( const step_iterator< Iterator > &  i,
Size  n 
)
friend

Definition at line 164 of file steppingiterator.hpp.

◆ operator- [2/2]

difference_type operator- ( const step_iterator< Iterator > &  lhs,
const step_iterator< Iterator > &  rhs 
)
friend

Definition at line 168 of file steppingiterator.hpp.

◆ operator==

bool operator== ( const step_iterator< Iterator > &  lhs,
const step_iterator< Iterator > &  rhs 
)
friend

Definition at line 175 of file steppingiterator.hpp.

◆ operator!=

bool operator!= ( const step_iterator< Iterator > &  lhs,
const step_iterator< Iterator > &  rhs 
)
friend

Definition at line 179 of file steppingiterator.hpp.

◆ operator<

bool operator< ( const step_iterator< Iterator > &  lhs,
const step_iterator< Iterator > &  rhs 
)
friend

Definition at line 183 of file steppingiterator.hpp.

◆ operator>

bool operator> ( const step_iterator< Iterator > &  lhs,
const step_iterator< Iterator > &  rhs 
)
friend

Definition at line 190 of file steppingiterator.hpp.

◆ operator<=

bool operator<= ( const step_iterator< Iterator > &  lhs,
const step_iterator< Iterator > &  rhs 
)
friend

Definition at line 197 of file steppingiterator.hpp.

◆ operator>=

bool operator>= ( const step_iterator< Iterator > &  lhs,
const step_iterator< Iterator > &  rhs 
)
friend

Definition at line 204 of file steppingiterator.hpp.

◆ make_step_iterator()

step_iterator< Iterator > make_step_iterator ( Iterator  it,
Size  step 
)
related

helper function to create step iterators

Definition at line 215 of file steppingiterator.hpp.

Member Data Documentation

◆ base_

Iterator base_ {}
private

Definition at line 46 of file steppingiterator.hpp.

◆ step_

BigInteger step_ {}
private

Definition at line 48 of file steppingiterator.hpp.