TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::mesh::mesh_iterator< M >

#include <triqs/mesh/mesh_iterator.hpp>

Detailed Description

template<typename M>
struct triqs::mesh::mesh_iterator< M >

A generic random access iterator for 1D meshes.

The iterator simply store a pointer to the underlying mesh and the data index of the current mesh point. It uses the mesh's operator[] to access the mesh points via the data index.

Template Parameters
MMesh type.

Definition at line 44 of file mesh_iterator.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 = typename M::mesh_point_t
 Value type.

Public Member Functions

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

Public Attributes

long data_index {-1}
 Current data index.
M const * mesh_ptr {nullptr}
 Pointer to the underlying mesh.

Friends

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

Member Function Documentation

◆ operator*()

template<typename M>
value_type triqs::mesh::mesh_iterator< M >::operator* ( ) const
inlinenodiscardnoexcept

Dereference operator.

Returns
Mesh point at the current data index.

Definition at line 124 of file mesh_iterator.hpp.

◆ operator+()

template<typename M>
mesh_iterator triqs::mesh::mesh_iterator< M >::operator+ ( difference_type n) const
inlinenodiscardnoexcept

Addition operator for an iterator and an integer.

Parameters
nNumber of steps to add to the current data index.
Returns
Copy of this object with its current data index increased by \( n \).

Definition at line 147 of file mesh_iterator.hpp.

◆ operator++() [1/2]

template<typename M>
mesh_iterator & triqs::mesh::mesh_iterator< M >::operator++ ( )
inlinenoexcept

Pre-increment operator increments the current data index by \( 1 \).

Returns
Reference to this iterator.

Definition at line 70 of file mesh_iterator.hpp.

◆ operator++() [2/2]

template<typename M>
mesh_iterator triqs::mesh::mesh_iterator< M >::operator++ ( int )
inlinenoexcept

Post-increment operator increments the current data index by \( 1 \).

Returns
Copy of this iterator before incrementing.

Definition at line 79 of file mesh_iterator.hpp.

◆ operator+=()

template<typename M>
mesh_iterator & triqs::mesh::mesh_iterator< M >::operator+= ( difference_type n)
inlinenoexcept

Addition assignment operator.

Parameters
nNumber of steps to add to the current data index.
Returns
Reference to this iterator with its current data index increased by \( n \).

Definition at line 137 of file mesh_iterator.hpp.

◆ operator-() [1/2]

template<typename M>
mesh_iterator triqs::mesh::mesh_iterator< M >::operator- ( difference_type n) const
inlinenodiscardnoexcept

Subtraction operator for an iterator and an integer.

Parameters
nNumber of steps to subtract from the current data index.
Returns
Copy of this iterator with its current data index decreased by \( n \).

Definition at line 172 of file mesh_iterator.hpp.

◆ operator-() [2/2]

template<typename M>
difference_type triqs::mesh::mesh_iterator< M >::operator- ( mesh_iterator< M > 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 179 of file mesh_iterator.hpp.

◆ operator--() [1/2]

template<typename M>
mesh_iterator & triqs::mesh::mesh_iterator< M >::operator-- ( )
inlinenoexcept

Pre-decrement operator decrements the current data index by \( 1 \).

Returns
Reference to this iterator.

Definition at line 89 of file mesh_iterator.hpp.

◆ operator--() [2/2]

template<typename M>
mesh_iterator triqs::mesh::mesh_iterator< M >::operator-- ( int )
inlinenoexcept

Post-decrement operator decrements the current data index by \( 1 \).

Returns
Copy of this iterator before decrementing.

Definition at line 98 of file mesh_iterator.hpp.

◆ operator-=()

template<typename M>
mesh_iterator & triqs::mesh::mesh_iterator< M >::operator-= ( difference_type n)
inlinenoexcept

Subtraction assignment operator.

Parameters
nNumber of steps to subtract from the current data index.
Returns
Reference to this iterator with its current data index decreased by \( n \).

Definition at line 162 of file mesh_iterator.hpp.

◆ operator->()

template<typename M>
value_type triqs::mesh::mesh_iterator< M >::operator-> ( ) const
inlinenodiscardnoexcept

Member access operator.

Returns
Mesh point at the current data index.

Definition at line 130 of file mesh_iterator.hpp.

◆ operator<=>()

template<typename M>
std::strong_ordering triqs::mesh::mesh_iterator< M >::operator<=> ( mesh_iterator< M > const & rhs) const
inlinenodiscardnoexcept

Three-way comparison operator for two iterators.

Parameters
rhsRight hand side iterator to compare with.
Returns
It returns the result of a three-way comparison of their current values.

Definition at line 110 of file mesh_iterator.hpp.

◆ operator==()

template<typename M>
bool triqs::mesh::mesh_iterator< M >::operator== ( mesh_iterator< M > const & other) const
inlinenodiscardnoexcept

Equal-to operator for two iterators.

Parameters
otherIterator to compare with.
Returns
True, if they belong to the same mesh and if their current data indices are equal.

Definition at line 118 of file mesh_iterator.hpp.

◆ operator[]()

template<typename M>
value_type triqs::mesh::mesh_iterator< M >::operator[] ( difference_type n) const
inlinenodiscardnoexcept

Subscript operator.

Parameters
nNumber of steps to add to the current value.
Returns
Mesh point at the current data index increased by \( n \).

Definition at line 186 of file mesh_iterator.hpp.

◆ operator+

template<typename M>
mesh_iterator operator+ ( difference_type n,
mesh_iterator< M > it )
friend

Addition operator for an integer and an iterator.

Parameters
nNumber of steps to add to the current data index of the iterator.
itIterator.
Returns
Copy of the given iterator with its current data index increased by \( n \).

Definition at line 155 of file mesh_iterator.hpp.


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