TRIQS/itertools 1.3.0
C++ range library
Loading...
Searching...
No Matches
itertools::range::const_iterator

#include <itertools/range.hpp>

Detailed Description

Const iterator type for itertools::range.

Definition at line 178 of file range.hpp.

Public Types

using difference_type = std::ptrdiff_t
 Difference type.
 
using iterator_category = std::random_access_iterator_tag
 Iterator category.
 
using pointer = value_type *
 Pointer type.
 
using reference = value_type const &
 Reference type.
 
using value_type = long
 Value type.
 

Public Member Functions

long operator* () const noexcept
 Dereference operator.
 
const_iterator operator+ (difference_type n) const noexcept
 Addition operator for an iterator and an integer.
 
const_iteratoroperator++ () noexcept
 Pre-increment operator increments the current value by the step size.
 
const_iterator operator++ (int) noexcept
 Post-increment operator increments the current value by the step size.
 
const_iteratoroperator+= (difference_type n) noexcept
 Addition assignment operator.
 
difference_type operator- (const_iterator const &rhs) const noexcept
 Get the distance between two iterators.
 
const_iterator operator- (difference_type n) const noexcept
 Subtraction operator for an iterator and an integer.
 
const_iteratoroperator-- () noexcept
 Pre-decrement operator decrements the current value by the step size.
 
const_iterator operator-- (int) noexcept
 Post-decrement operator decrements the current value by the step size.
 
const_iteratoroperator-= (difference_type n) noexcept
 Subtraction assignment operator.
 
long operator-> () const noexcept
 Member access operator.
 
std::strong_ordering operator<=> (const_iterator const &rhs) const noexcept
 Three-way comparison operator for two iterators.
 
bool operator== (const_iterator const &other) const noexcept
 Equal-to operator for two iterators.
 
value_type operator[] (difference_type n) const noexcept
 Subscript operator.
 

Public Attributes

long pos
 Current value.
 
long step
 Step size.
 

Friends

const_iterator operator+ (difference_type n, const_iterator it) noexcept
 Addition operator for an integer and an iterator.
 

Member Function Documentation

◆ operator*()

long itertools::range::const_iterator::operator* ( ) const
inlinenodiscardnoexcept

Dereference operator.

Returns
Current value of this iterator.

Definition at line 261 of file range.hpp.

◆ operator+()

const_iterator itertools::range::const_iterator::operator+ ( difference_type n) const
inlinenodiscardnoexcept

Addition operator for an iterator and an integer.

Parameters
nNumber of steps to add to the current value.
Returns
Copy of this object with its current value increased by the step size multiplied by \( n \).

Definition at line 284 of file range.hpp.

◆ operator++() [1/2]

const_iterator & itertools::range::const_iterator::operator++ ( )
inlinenoexcept

Pre-increment operator increments the current value by the step size.

Returns
Reference to this iterator.

Definition at line 204 of file range.hpp.

◆ operator++() [2/2]

const_iterator itertools::range::const_iterator::operator++ ( int )
inlinenoexcept

Post-increment operator increments the current value by the step size.

Returns
Copy of this iterator before incrementing.

Definition at line 213 of file range.hpp.

◆ operator+=()

const_iterator & itertools::range::const_iterator::operator+= ( difference_type n)
inlinenoexcept

Addition assignment operator.

Parameters
nNumber of steps to add to the current value.
Returns
Reference to this iterator with its current value increased by the step size multiplied by \( n \).

Definition at line 274 of file range.hpp.

◆ operator-() [1/2]

difference_type itertools::range::const_iterator::operator- ( const_iterator const & rhs) const
inlinenodiscardnoexcept

Get the distance between two iterators.

Parameters
rhsRight-hand side iterator.
Returns
Number of steps between the two iterators.

Definition at line 316 of file range.hpp.

◆ operator-() [2/2]

const_iterator itertools::range::const_iterator::operator- ( difference_type n) const
inlinenodiscardnoexcept

Subtraction operator for an iterator and an integer.

Parameters
nNumber of steps to subtract from the current value.
Returns
Copy of this iterator with its current value decreased by the step size multiplied by \( n \).

Definition at line 309 of file range.hpp.

◆ operator--() [1/2]

const_iterator & itertools::range::const_iterator::operator-- ( )
inlinenoexcept

Pre-decrement operator decrements the current value by the step size.

Returns
Reference to this iterator.

Definition at line 223 of file range.hpp.

◆ operator--() [2/2]

const_iterator itertools::range::const_iterator::operator-- ( int )
inlinenoexcept

Post-decrement operator decrements the current value by the step size.

Returns
Copy of this iterator before decrementing.

Definition at line 232 of file range.hpp.

◆ operator-=()

const_iterator & itertools::range::const_iterator::operator-= ( difference_type n)
inlinenoexcept

Subtraction assignment operator.

Parameters
nNumber of steps to subtract from the current value.
Returns
Reference to this iterator with its current value decreased by the step size multiplied by \( n \).

Definition at line 299 of file range.hpp.

◆ operator->()

long itertools::range::const_iterator::operator-> ( ) const
inlinenodiscardnoexcept

Member access operator.

Returns
Current value of this iterator.

Definition at line 267 of file range.hpp.

◆ operator<=>()

std::strong_ordering itertools::range::const_iterator::operator<=> ( const_iterator const & rhs) const
inlinenodiscardnoexcept

Three-way comparison operator for two iterators.

Parameters
rhsRight hand side iterator to compare with.
Returns
If the step size is > 0, it returns the result of a three-way comparison of their current values. Otherwise, it three-way compares their negative values.

Definition at line 245 of file range.hpp.

◆ operator==()

bool itertools::range::const_iterator::operator== ( const_iterator const & other) const
inlinenodiscardnoexcept

Equal-to operator for two iterators.

Parameters
otherIterator to compare with.
Returns
True, if the current values of both iterators are equal.

Definition at line 255 of file range.hpp.

◆ operator[]()

value_type itertools::range::const_iterator::operator[] ( difference_type n) const
inlinenodiscardnoexcept

Subscript operator.

Parameters
nNumber of steps to add to the current value.
Returns
Current value increased by the step size multiplied by \( n \).

Definition at line 323 of file range.hpp.

Friends And Related Symbol Documentation

◆ operator+

const_iterator operator+ ( difference_type n,
const_iterator it )
friend

Addition operator for an integer and an iterator.

Parameters
nNumber of steps to add to the current value of the iterator.
itIterator.
Returns
Copy of the given iterator with its current value increased by the step size multiplied by \( n \).

Definition at line 292 of file range.hpp.


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