24#ifndef quantlib_stepping_iterator_hpp
25#define quantlib_stepping_iterator_hpp
40 template <std::random_access_iterator Iterator>
42 template <
class Iterator>
53 using value_type =
typename std::iterator_traits<Iterator>::value_type;
54 using pointer =
typename std::iterator_traits<Iterator>::pointer;
55 using reference =
typename std::iterator_traits<Iterator>::reference;
62 template <
class OtherIterator>
64 std::enable_if_t<std::is_convertible
65 <OtherIterator, Iterator>::value>* =
nullptr)
74 [[deprecated(
"Do not use the boost::iterator_adaptor interface.")]]
80 [[deprecated(
"Do not use the boost::iterator_adaptor interface.")]]
88 [[deprecated(
"Do not use the boost::iterator_adaptor interface.")]]
96 [[deprecated(
"Do not use the boost::iterator_adaptor interface.")]]
97 void advance(
typename std::iterator_traits<Iterator>::difference_type
n) {
104 [[deprecated(
"Do not use the boost::iterator_adaptor interface.")]]
105 typename std::iterator_traits<Iterator>::difference_type
169#ifdef QL_EXTRA_SAFETY_CHECKS
170 QL_REQUIRE(lhs.
step_ == rhs.
step_,
"step_iterators with different step cannot be added or subtracted");
184#ifdef QL_EXTRA_SAFETY_CHECKS
191#ifdef QL_EXTRA_SAFETY_CHECKS
198#ifdef QL_EXTRA_SAFETY_CHECKS
205#ifdef QL_EXTRA_SAFETY_CHECKS
214 template <
class Iterator>
Iterator advancing in constant steps.
step_iterator & operator++()
step_iterator operator++(int)
step_iterator & operator--()
void advance(typename std::iterator_traits< Iterator >::difference_type n)
friend bool operator<=(const step_iterator &lhs, const step_iterator &rhs)
typename std::iterator_traits< Iterator >::reference reference
friend step_iterator operator-(const step_iterator &i, Size n)
step_iterator & operator=(const step_iterator &other)
reference operator[](Size n) const
friend step_iterator operator+(const step_iterator &i, Size n)
step_iterator< Iterator > make_step_iterator(Iterator it, Size step)
helper function to create step iterators
friend bool operator>=(const step_iterator &lhs, const step_iterator &rhs)
friend difference_type operator-(const step_iterator &lhs, const step_iterator &rhs)
friend bool operator<(const step_iterator &lhs, const step_iterator &rhs)
step_iterator & operator-=(Size n)
step_iterator & operator+=(Size n)
reference operator*() const
friend step_iterator operator+(Size n, const step_iterator &i)
friend bool operator>(const step_iterator &lhs, const step_iterator &rhs)
typename std::iterator_traits< Iterator >::difference_type difference_type
step_iterator(const Iterator &base, Size step)
friend bool operator!=(const step_iterator &lhs, const step_iterator &rhs)
typename std::iterator_traits< Iterator >::iterator_category iterator_category
typename std::iterator_traits< Iterator >::value_type value_type
typename std::iterator_traits< Iterator >::pointer pointer
friend bool operator==(const step_iterator &lhs, const step_iterator &rhs)
step_iterator(const step_iterator< OtherIterator > &i, std::enable_if_t< std::is_convertible< OtherIterator, Iterator >::value > *=nullptr)
std::iterator_traits< Iterator >::difference_type distance_to(const step_iterator &i) const
step_iterator operator--(int)
Classes and functions for error handling.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
QL_BIG_INTEGER BigInteger
large integer number
std::size_t Size
size of a container