StormByte 3.0.0
C++26 foundation of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Safe::List< T >::BasicIterator< IsConst > Class Template Referencefinal

Bidirectional cursor over Base-owned list nodes. More...

#include <StormByte/safe/list.hxx>

Public Types

using iterator_category = std::bidirectional_iterator_tag
 Iterator category.
using iterator_concept = std::bidirectional_iterator_tag
 C++20 iterator concept.
using value_type = T
 Element type.
using difference_type = std::ptrdiff_t
 Iterator distance type.
using reference = std::conditional_t<IsConst, const T&, T&>
 Element reference.
using pointer = std::conditional_t<IsConst, const T*, T*>
 Element pointer.
using StormByteSafeCursor = void
 Base cursor mark. Copying the cursor copies one link pointer.

Public Member Functions

 BasicIterator () noexcept
 Construct a singular iterator.
template<bool OtherConst>
requires IsConst
&&!OtherConst BasicIterator (const BasicIterator< OtherConst > &other) noexcept
 Convert a mutable iterator to a const iterator.
reference operator* () const noexcept
 Return the element stored in the node.
pointer operator-> () const noexcept
 Access the element stored in the node.
BasicIterator & operator++ () noexcept
 Advance to the next element.
BasicIterator operator++ (int) noexcept
 Advance to the next element.
BasicIterator & operator-- () noexcept
 Move to the previous element.
BasicIterator operator-- (int) noexcept
 Move to the previous element.
template<bool OtherConst>
bool operator== (const BasicIterator< OtherConst > &other) const noexcept
 Compare link identity.

Friends

class List
template<bool>
class BasicIterator

Detailed Description

template<Type::SafeValue T>
template<bool IsConst>
class StormByte::Safe::List< T >::BasicIterator< IsConst >

Bidirectional cursor over Base-owned list nodes.

Template Parameters
IsConstWhether dereference is read-only.

The cursor stores one link pointer. End designates the sentinel. Copying it does not allocate and does not take ownership.

Member Typedef Documentation

◆ difference_type

template<Type::SafeValue T>
template<bool IsConst>
using StormByte::Safe::List< T >::BasicIterator< IsConst >::difference_type = std::ptrdiff_t

Iterator distance type.

◆ iterator_category

template<Type::SafeValue T>
template<bool IsConst>
using StormByte::Safe::List< T >::BasicIterator< IsConst >::iterator_category = std::bidirectional_iterator_tag

Iterator category.

◆ iterator_concept

template<Type::SafeValue T>
template<bool IsConst>
using StormByte::Safe::List< T >::BasicIterator< IsConst >::iterator_concept = std::bidirectional_iterator_tag

C++20 iterator concept.

◆ pointer

template<Type::SafeValue T>
template<bool IsConst>
using StormByte::Safe::List< T >::BasicIterator< IsConst >::pointer = std::conditional_t<IsConst, const T*, T*>

Element pointer.

◆ reference

template<Type::SafeValue T>
template<bool IsConst>
using StormByte::Safe::List< T >::BasicIterator< IsConst >::reference = std::conditional_t<IsConst, const T&, T&>

Element reference.

◆ StormByteSafeCursor

template<Type::SafeValue T>
template<bool IsConst>
using StormByte::Safe::List< T >::BasicIterator< IsConst >::StormByteSafeCursor = void

Base cursor mark. Copying the cursor copies one link pointer.

◆ value_type

template<Type::SafeValue T>
template<bool IsConst>
using StormByte::Safe::List< T >::BasicIterator< IsConst >::value_type = T

Element type.

Constructor & Destructor Documentation

◆ BasicIterator() [1/2]

template<Type::SafeValue T>
template<bool IsConst>
StormByte::Safe::List< T >::BasicIterator< IsConst >::BasicIterator ( )
inlinenoexcept

Construct a singular iterator.

◆ BasicIterator() [2/2]

template<Type::SafeValue T>
template<bool IsConst>
template<bool OtherConst>
requires IsConst
&&!OtherConst StormByte::Safe::List< T >::BasicIterator< IsConst >::BasicIterator ( const BasicIterator< OtherConst > & other)
inlinenoexcept

Convert a mutable iterator to a const iterator.

Parameters
otherMutable iterator.

Member Function Documentation

◆ operator*()

template<Type::SafeValue T>
template<bool IsConst>
reference StormByte::Safe::List< T >::BasicIterator< IsConst >::operator* ( ) const
inlinenoexcept

Return the element stored in the node.

Returns
Element reference. Valid until the node is erased.

◆ operator++() [1/2]

template<Type::SafeValue T>
template<bool IsConst>
BasicIterator & StormByte::Safe::List< T >::BasicIterator< IsConst >::operator++ ( )
inlinenoexcept

Advance to the next element.

Returns
This iterator.

◆ operator++() [2/2]

template<Type::SafeValue T>
template<bool IsConst>
BasicIterator StormByte::Safe::List< T >::BasicIterator< IsConst >::operator++ ( int )
inlinenoexcept

Advance to the next element.

Returns
Previous iterator value.

◆ operator--() [1/2]

template<Type::SafeValue T>
template<bool IsConst>
BasicIterator & StormByte::Safe::List< T >::BasicIterator< IsConst >::operator-- ( )
inlinenoexcept

Move to the previous element.

Returns
This iterator.

◆ operator--() [2/2]

template<Type::SafeValue T>
template<bool IsConst>
BasicIterator StormByte::Safe::List< T >::BasicIterator< IsConst >::operator-- ( int )
inlinenoexcept

Move to the previous element.

Returns
Previous iterator value.

◆ operator->()

template<Type::SafeValue T>
template<bool IsConst>
pointer StormByte::Safe::List< T >::BasicIterator< IsConst >::operator-> ( ) const
inlinenoexcept

Access the element stored in the node.

Returns
Element pointer. Valid until the node is erased.

◆ operator==()

template<Type::SafeValue T>
template<bool IsConst>
template<bool OtherConst>
bool StormByte::Safe::List< T >::BasicIterator< IsConst >::operator== ( const BasicIterator< OtherConst > & other) const
inlinenoexcept

Compare link identity.

Parameters
otherIterator to compare.
Returns
Whether both designate the same link.

◆ BasicIterator

template<Type::SafeValue T>
template<bool IsConst>
template<bool>
friend class BasicIterator
friend

◆ List

template<Type::SafeValue T>
template<bool IsConst>
friend class List
friend

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