kblib 0.2.3
General utilities library for modern C++
kblib::range_t< Value, Delta >::iterator Struct Reference

A helper struct which acts as an iterator for the range elements, as they are generated on the fly. More...

#include <kblib/iterators.h>

Public Types

using difference_type = std::ptrdiff_t
 
using value_type = Value
 
using pointer = const Value *
 
using reference = Value
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

constexpr auto operator* () const noexcept(nothrow_copyable) -> Value
 Return the "pointed-to" value. More...
 
constexpr auto operator-> () const noexcept -> pointer
 Return a pointer to the value. More...
 
constexpr auto operator++ () &noexcept(nothrow_steppable) -> iterator &
 Prefix increment. Advance to the next value in the range. More...
 
constexpr auto operator++ (int) noexcept(nothrow_steppable) -> iterator
 Postfix increment. Advance to the next value in the range, but return the current value. More...
 
constexpr auto operator[] (std::ptrdiff_t x) const noexcept -> Value
 
template<typename Integral >
constexpr auto operator[] (Integral x) const noexcept -> Value
 

Public Attributes

Value val
 
Delta step
 

Friends

constexpr friend auto operator== (iterator l, iterator r) noexcept -> bool
 Compare two range iterators for equality. More...
 
constexpr friend auto operator!= (iterator l, iterator r) noexcept -> bool
 Compare two range iterators for inequality. More...
 
constexpr friend auto operator< (iterator l, iterator r) noexcept -> bool
 Compare two range iterators. More...
 
constexpr friend auto operator<= (iterator l, iterator r) noexcept -> bool
 Compare two range iterators. More...
 
constexpr friend auto operator> (iterator l, iterator r) noexcept -> bool
 Compare two range iterators. More...
 
constexpr friend auto operator>= (iterator l, iterator r) noexcept -> bool
 Compare two range iterators. More...
 

Detailed Description

template<typename Value, typename Delta>
struct kblib::range_t< Value, Delta >::iterator

A helper struct which acts as an iterator for the range elements, as they are generated on the fly.

Definition at line 259 of file iterators.h.

Member Typedef Documentation

◆ difference_type

template<typename Value , typename Delta >
using kblib::range_t< Value, Delta >::iterator::difference_type = std::ptrdiff_t

Definition at line 263 of file iterators.h.

◆ iterator_category

template<typename Value , typename Delta >
using kblib::range_t< Value, Delta >::iterator::iterator_category = std::input_iterator_tag

Definition at line 267 of file iterators.h.

◆ pointer

template<typename Value , typename Delta >
using kblib::range_t< Value, Delta >::iterator::pointer = const Value*

Definition at line 265 of file iterators.h.

◆ reference

template<typename Value , typename Delta >
using kblib::range_t< Value, Delta >::iterator::reference = Value

Definition at line 266 of file iterators.h.

◆ value_type

template<typename Value , typename Delta >
using kblib::range_t< Value, Delta >::iterator::value_type = Value

Definition at line 264 of file iterators.h.

Member Function Documentation

◆ operator*()

template<typename Value , typename Delta >
constexpr auto kblib::range_t< Value, Delta >::iterator::operator* ( ) const -> Value
inlineconstexprnoexcept

Return the "pointed-to" value.

Returns
Value The value in the range this iterator corresponds to.

Definition at line 274 of file iterators.h.

◆ operator++() [1/2]

template<typename Value , typename Delta >
constexpr auto kblib::range_t< Value, Delta >::iterator::operator++ ( ) & -> iterator&
inlineconstexprnoexcept

Prefix increment. Advance to the next value in the range.

Returns
iterator& *this.

Definition at line 289 of file iterators.h.

◆ operator++() [2/2]

template<typename Value , typename Delta >
constexpr auto kblib::range_t< Value, Delta >::iterator::operator++ ( int  ) -> iterator
inlineconstexprnoexcept

Postfix increment. Advance to the next value in the range, but return the current value.

Returns
iterator A copy of the pre-incrementing value of *this.

Definition at line 299 of file iterators.h.

◆ operator->()

template<typename Value , typename Delta >
constexpr auto kblib::range_t< Value, Delta >::iterator::operator-> ( ) const -> pointer
inlineconstexprnoexcept

Return a pointer to the value.

Returns
pointer A pointer to a value equivalent to *(*this). Valid until the iterator is modified in any way or destroyed.

Definition at line 283 of file iterators.h.

◆ operator[]() [1/2]

template<typename Value , typename Delta >
template<typename Integral >
constexpr auto kblib::range_t< Value, Delta >::iterator::operator[] ( Integral  x) const -> Value
inlineconstexprnoexcept

Definition at line 369 of file iterators.h.

◆ operator[]() [2/2]

template<typename Value , typename Delta >
constexpr auto kblib::range_t< Value, Delta >::iterator::operator[] ( std::ptrdiff_t  x) const -> Value
inlineconstexprnoexcept

Definition at line 365 of file iterators.h.

Friends And Related Function Documentation

◆ operator!=

template<typename Value , typename Delta >
constexpr friend auto operator!= ( iterator  l,
iterator  r 
) -> bool
friend

Compare two range iterators for inequality.

Range iterators compare equal if they point to the same value and have the same step.

Definition at line 320 of file iterators.h.

◆ operator<

template<typename Value , typename Delta >
constexpr friend auto operator< ( iterator  l,
iterator  r 
) -> bool
friend

Compare two range iterators.

For range iterators, (A < B) is true when A can be advanced until (*A - *B) changes sign.

Definition at line 330 of file iterators.h.

◆ operator<=

template<typename Value , typename Delta >
constexpr friend auto operator<= ( iterator  l,
iterator  r 
) -> bool
friend

Compare two range iterators.

For range iterators, (A < B) is true when A can be advanced until (*A - *B) changes sign.

Definition at line 342 of file iterators.h.

◆ operator==

template<typename Value , typename Delta >
constexpr friend auto operator== ( iterator  l,
iterator  r 
) -> bool
friend

Compare two range iterators for equality.

Range iterators compare equal if they point to the same value and have the same step.

Definition at line 310 of file iterators.h.

◆ operator>

template<typename Value , typename Delta >
constexpr friend auto operator> ( iterator  l,
iterator  r 
) -> bool
friend

Compare two range iterators.

For range iterators, (A < B) is true when A can be advanced until (*A - *B) changes sign.

Definition at line 352 of file iterators.h.

◆ operator>=

template<typename Value , typename Delta >
constexpr friend auto operator>= ( iterator  l,
iterator  r 
) -> bool
friend

Compare two range iterators.

For range iterators, (A < B) is true when A can be advanced until (*A - *B) changes sign.

Definition at line 361 of file iterators.h.

Member Data Documentation

◆ step

template<typename Value , typename Delta >
Delta kblib::range_t< Value, Delta >::iterator::step

Definition at line 261 of file iterators.h.

◆ val

template<typename Value , typename Delta >
Value kblib::range_t< Value, Delta >::iterator::val

Definition at line 260 of file iterators.h.


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