Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
StlConstIterator< SetType > Struct Template Reference

STL-compatible const iterator adapter for Aleph containers. More...

#include <ah-iterator.H>

Inheritance diagram for StlConstIterator< SetType >:
[legend]
Collaboration diagram for StlConstIterator< SetType >:
[legend]

Public Types

using T = typename SetType::Item_Type
 
using Itor = typename SetType::Iterator
 
using iterator_category = std::conditional_t< AlephRandomAccessItor< Itor >, std::random_access_iterator_tag, std::forward_iterator_tag >
 Category is promoted to random-access when the underlying Aleph iterator opts in (see AlephRandomAccessItor); otherwise it stays forward, which is the historical default and never a regression.
 
using iterator_concept = iterator_category
 
using difference_type = std::ptrdiff_t
 
using pointer = const T *
 
using reference = const T &
 
using value_type = T
 

Public Member Functions

 StlConstIterator () noexcept=default
 Default constructor creates an "end" iterator (no current element).
 
StlConstIterator & operator++ ()
 Pre-increment: advance to the next element.
 
StlConstIterator operator++ (int)
 Post-increment: advance to the next element and return the old iterator.
 
bool operator== (const StlConstIterator &it) const
 Equality compares positions when both iterators are valid; otherwise both must be in the end state.
 
bool operator!= (const StlConstIterator &it) const
 Inequality.
 
const T & operator* () const
 Dereference: return the current element.
 
const T * operator-> () const
 Member access to the current element.
 
StlConstIterator & operator-- ()
 Pre-decrement: move to the previous element.
 
StlConstIterator operator-- (int)
 Post-decrement: move to the previous element and return the old iterator.
 
StlConstIterator & operator+= (difference_type n)
 Advance the iterator n positions (n may be negative).
 
StlConstIterator & operator-= (difference_type n)
 Move the iterator back n positions (n may be negative).
 
StlConstIterator operator+ (difference_type n) const
 Return an iterator advanced n positions.
 
StlConstIterator operator- (difference_type n) const
 Return an iterator moved back n positions.
 
difference_type operator- (const StlConstIterator &it) const
 Return the signed distance between two iterators.
 
reference operator[] (difference_type n) const
 Access the element n positions away from the current one.
 
std::strong_ordering operator<=> (const StlConstIterator &it) const
 Order two iterators by their logical position.
 

Static Public Member Functions

static StlConstIterator cbegin (const SetType &s)
 Create a const iterator positioned at the first element of the container.
 
static StlConstIterator cend (const SetType &s)
 Create a const end iterator for the container.
 

Friends

StlConstIterator operator+ (difference_type n, const StlConstIterator &it)
 Return an iterator advanced n positions (symmetric form).
 

Detailed Description

template<class SetType>
struct StlConstIterator< SetType >

STL-compatible const iterator adapter for Aleph containers.

This adapter provides a read-only view over the underlying Aleph iterator.

Template Parameters
SetTypeAleph container type.

Definition at line 285 of file ah-iterator.H.

Member Typedef Documentation

◆ difference_type

template<class SetType >
using StlConstIterator< SetType >::difference_type = std::ptrdiff_t

Definition at line 297 of file ah-iterator.H.

◆ iterator_category

template<class SetType >
using StlConstIterator< SetType >::iterator_category = std::conditional_t<AlephRandomAccessItor<Itor>, std::random_access_iterator_tag, std::forward_iterator_tag>

Category is promoted to random-access when the underlying Aleph iterator opts in (see AlephRandomAccessItor); otherwise it stays forward, which is the historical default and never a regression.

Definition at line 293 of file ah-iterator.H.

◆ iterator_concept

template<class SetType >
using StlConstIterator< SetType >::iterator_concept = iterator_category

Definition at line 295 of file ah-iterator.H.

◆ Itor

template<class SetType >
using StlConstIterator< SetType >::Itor = typename SetType::Iterator

Definition at line 288 of file ah-iterator.H.

◆ pointer

template<class SetType >
using StlConstIterator< SetType >::pointer = const T *

Definition at line 299 of file ah-iterator.H.

◆ reference

template<class SetType >
using StlConstIterator< SetType >::reference = const T &

Definition at line 301 of file ah-iterator.H.

◆ T

template<class SetType >
using StlConstIterator< SetType >::T = typename SetType::Item_Type

Definition at line 287 of file ah-iterator.H.

◆ value_type

template<class SetType >
using StlConstIterator< SetType >::value_type = T

Definition at line 303 of file ah-iterator.H.

Constructor & Destructor Documentation

◆ StlConstIterator()

template<class SetType >
StlConstIterator< SetType >::StlConstIterator ( )
defaultnoexcept

Default constructor creates an "end" iterator (no current element).

Referenced by StlConstIterator< SetType >::cbegin().

Member Function Documentation

◆ cbegin()

template<class SetType >
static StlConstIterator StlConstIterator< SetType >::cbegin ( const SetType &  s)
inlinestatic

Create a const iterator positioned at the first element of the container.

Definition at line 449 of file ah-iterator.H.

References StlConstIterator< SetType >::StlConstIterator().

Referenced by StlAlephIterator< SetName >::begin(), and StlAlephIterator< SetName >::cbegin().

◆ cend()

template<class SetType >
static StlConstIterator StlConstIterator< SetType >::cend ( const SetType &  s)
inlinestatic

Create a const end iterator for the container.

Definition at line 455 of file ah-iterator.H.

Referenced by StlAlephIterator< SetName >::cend(), and StlAlephIterator< SetName >::end().

◆ operator!=()

template<class SetType >
bool StlConstIterator< SetType >::operator!= ( const StlConstIterator< SetType > &  it) const
inline

Inequality.

Definition at line 344 of file ah-iterator.H.

◆ operator*()

template<class SetType >
const T & StlConstIterator< SetType >::operator* ( ) const
inline

Dereference: return the current element.

Definition at line 350 of file ah-iterator.H.

◆ operator+()

template<class SetType >
StlConstIterator StlConstIterator< SetType >::operator+ ( difference_type  n) const
inline

Return an iterator advanced n positions.

Definition at line 401 of file ah-iterator.H.

◆ operator++() [1/2]

template<class SetType >
StlConstIterator & StlConstIterator< SetType >::operator++ ( )
inline

Pre-increment: advance to the next element.

Definition at line 311 of file ah-iterator.H.

◆ operator++() [2/2]

template<class SetType >
StlConstIterator StlConstIterator< SetType >::operator++ ( int  )
inline

Post-increment: advance to the next element and return the old iterator.

Definition at line 318 of file ah-iterator.H.

◆ operator+=()

template<class SetType >
StlConstIterator & StlConstIterator< SetType >::operator+= ( difference_type  n)
inline

Advance the iterator n positions (n may be negative).

Definition at line 385 of file ah-iterator.H.

◆ operator-() [1/2]

template<class SetType >
difference_type StlConstIterator< SetType >::operator- ( const StlConstIterator< SetType > &  it) const
inline

Return the signed distance between two iterators.

Definition at line 426 of file ah-iterator.H.

◆ operator-() [2/2]

template<class SetType >
StlConstIterator StlConstIterator< SetType >::operator- ( difference_type  n) const
inline

Return an iterator moved back n positions.

Definition at line 417 of file ah-iterator.H.

◆ operator--() [1/2]

template<class SetType >
StlConstIterator & StlConstIterator< SetType >::operator-- ( )
inline

Pre-decrement: move to the previous element.

Definition at line 368 of file ah-iterator.H.

◆ operator--() [2/2]

template<class SetType >
StlConstIterator StlConstIterator< SetType >::operator-- ( int  )
inline

Post-decrement: move to the previous element and return the old iterator.

Definition at line 376 of file ah-iterator.H.

◆ operator-=()

template<class SetType >
StlConstIterator & StlConstIterator< SetType >::operator-= ( difference_type  n)
inline

Move the iterator back n positions (n may be negative).

Definition at line 393 of file ah-iterator.H.

◆ operator->()

template<class SetType >
const T * StlConstIterator< SetType >::operator-> ( ) const
inline

Member access to the current element.

Definition at line 356 of file ah-iterator.H.

◆ operator<=>()

template<class SetType >
std::strong_ordering StlConstIterator< SetType >::operator<=> ( const StlConstIterator< SetType > &  it) const
inline

Order two iterators by their logical position.

Definition at line 442 of file ah-iterator.H.

◆ operator==()

template<class SetType >
bool StlConstIterator< SetType >::operator== ( const StlConstIterator< SetType > &  it) const
inline

Equality compares positions when both iterators are valid; otherwise both must be in the end state.

Definition at line 327 of file ah-iterator.H.

◆ operator[]()

template<class SetType >
reference StlConstIterator< SetType >::operator[] ( difference_type  n) const
inline

Access the element n positions away from the current one.

Definition at line 433 of file ah-iterator.H.

Friends And Related Symbol Documentation

◆ operator+

template<class SetType >
StlConstIterator operator+ ( difference_type  n,
const StlConstIterator< SetType > &  it 
)
friend

Return an iterator advanced n positions (symmetric form).

Definition at line 410 of file ah-iterator.H.


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