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

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

#include <ah-iterator.H>

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

Public Types

using T = typename SetType::Item_Type
 
using Itor = typename SetType::Iterator
 
using iterator_category = std::forward_iterator_tag
 
using iterator_concept = std::forward_iterator_tag
 
using difference_type = std::ptrdiff_t
 
using reference = decltype(std::declval< const Itor & >().get_curr())
 
using pointer = std::add_pointer_t< std::remove_reference_t< reference > >
 
using value_type = T
 

Public Member Functions

 StlIterator () noexcept=default
 Default constructor creates an "end" iterator (no current element).
 
StlIteratoroperator++ ()
 Pre-increment: advance to the next element.
 
StlIterator operator++ (int)
 Post-increment: advance to the next element and return the old iterator.
 
bool operator== (const StlIterator &it) const
 Equality compares positions when both iterators are valid; otherwise both must be in the end state.
 
bool operator!= (const StlIterator &it) const
 Inequality.
 
reference operator* () const
 Dereference: return the current element.
 
pointer operator-> () const
 Member access to the current element.
 

Static Public Member Functions

static StlIterator begin (SetType &s)
 Create an iterator positioned at the first element of the container.
 
static StlIterator end (SetType &s)
 Create an end iterator for the container.
 

Detailed Description

template<class SetType>
struct StlIterator< SetType >

STL-compatible mutable iterator adapter for Aleph containers.

This adapter wraps an Aleph-style iterator (SetType::Iterator) and exposes the operations expected by the STL and C++20 ranges.

Template Parameters
SetTypeAleph container type.
Note
Requirements on SetType::Iterator:
  • Constructible from SetType&.
  • bool has_curr() const.
  • void next().
  • auto & get_curr() const returning the current element.
  • auto get_pos() const returning a position that is stable and comparable between iterators over the same container.
  • void end() to move the iterator to the end sentinel.

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

Member Typedef Documentation

◆ difference_type

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

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

◆ iterator_category

template<class SetType >
using StlIterator< SetType >::iterator_category = std::forward_iterator_tag

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

◆ iterator_concept

template<class SetType >
using StlIterator< SetType >::iterator_concept = std::forward_iterator_tag

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

◆ Itor

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

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

◆ pointer

template<class SetType >
using StlIterator< SetType >::pointer = std::add_pointer_t<std::remove_reference_t<reference> >

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

◆ reference

template<class SetType >
using StlIterator< SetType >::reference = decltype(std::declval<const Itor &>().get_curr())

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

◆ T

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

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

◆ value_type

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

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

Constructor & Destructor Documentation

◆ StlIterator()

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

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

Referenced by StlIterator< SetType >::begin().

Member Function Documentation

◆ begin()

template<class SetType >
static StlIterator StlIterator< SetType >::begin ( SetType &  s)
inlinestatic

Create an iterator positioned at the first element of the container.

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

References StlIterator< SetType >::StlIterator().

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

◆ end()

template<class SetType >
static StlIterator StlIterator< SetType >::end ( SetType &  s)
inlinestatic

Create an end iterator for the container.

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

Referenced by StlAlephIterator< SetName >::end().

◆ operator!=()

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

Inequality.

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

◆ operator*()

template<class SetType >
reference StlIterator< SetType >::operator* ( ) const
inline

Dereference: return the current element.

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

◆ operator++() [1/2]

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

Pre-increment: advance to the next element.

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

◆ operator++() [2/2]

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

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

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

◆ operator->()

template<class SetType >
pointer StlIterator< SetType >::operator-> ( ) const
inline

Member access to the current element.

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

◆ operator==()

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

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

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


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