__GNU_DEBUG::_SAFE_ITERATOR(3cxx)

πŸ’– __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category > πŸ’–

manual page (3cxx) β€” safe iterator wrapper, but make it fashion

🌸 NAME 🌸

__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category > β€” safe iterator wrapper. that's the whole name, bestie, and it's iconic πŸ’…

✨ SYNOPSIS ✨

#include <safe_iterator.h>
  • Inherits _Iterator, and __gnu_debug::_Safe_iterator_base.
  • Inherited by __gnu_debug::_Safe_iterator< _Iterator, _Sequence, std::random_access_iterator_tag >.

πŸŽ€ Public Types πŸŽ€

  • typedef _Safe_iterator< _Iterator, _Sequence, iterator_category > _Self
  • typedef _Traits::difference_type difference_type
  • typedef _Traits::iterator_category iterator_category
  • typedef _Iterator iterator_type
  • typedef _Traits::pointer pointer
  • typedef _Traits::reference reference
  • typedef _Traits::value_type value_type

πŸ’… Public Member Functions πŸ’…

  • constexpr _Safe_iterator () noexcept
  • constexpr _Safe_iterator (_Iterator __i, const _Safe_sequence_base *__seq) noexcept β€” safe iterator construction from an unsafe iterator and its sequence.
  • constexpr _Safe_iterator (_Safe_iterator &&__x) noexcept β€” move construction.
  • constexpr _Safe_iterator (const _Safe_iterator &__x) noexcept β€” copy construction.
  • template<typename _MutableIterator > constexpr _Safe_iterator (const _Safe_iterator< _MutableIterator, _Sequence, typename __gnu_cxx::__enable_if< _IsConstant::__value &&std::__are_same< _MutableIterator, _OtherIterator >::__value, _Category >::__type > &__x) noexcept β€” converting constructor from a mutable iterator to a constant iterator.
  • void _M_attach (_Safe_sequence_base *__seq)
  • void _M_attach_single (_Safe_sequence_base *__seq)
  • bool _M_attached_to (const _Safe_sequence_base *__seq) const
  • bool _M_before_dereferenceable () const β€” is the iterator before a dereferenceable one?
  • template<typename _Diff > bool _M_can_advance (const std::pair< _Diff, _Distance_precision > &__dist, int __way) const
  • bool _M_can_advance (difference_type __n, bool __strict=false) const
  • bool _M_can_compare (const _Safe_iterator_base &__x) const throw ()
  • bool _M_dereferenceable () const β€” is the iterator dereferenceable?
  • void _M_detach_single () throw ()
  • _Distance_traits< _Iterator >::__type _M_get_distance_from_begin () const
  • _Distance_traits< _Iterator >::__type _M_get_distance_to (const _Safe_iterator &__rhs) const
  • _Distance_traits< _Iterator >::__type _M_get_distance_to_end () const
  • __gnu_cxx::__conditional_type< _IsConstant::__value, const_Sequence *, _Sequence * >::__type _M_get_sequence () const
  • bool _M_incrementable () const β€” is the iterator incrementable?
  • void _M_invalidate ()
  • bool _M_is_before_begin () const β€” is this iterator equal to the sequence's before_begin() iterator if any?
  • constexpr bool _M_is_begin () const β€” is this iterator equal to the sequence's begin() iterator?
  • bool _M_is_beginnest () const β€” is this iterator equal to the sequence's before_begin() iterator if any or begin() otherwise?
  • bool _M_is_end () const β€” is this iterator equal to the sequence's end() iterator?
  • void _M_reset () throw ()
  • bool _M_singular () const throw ()
  • void _M_unlink () throw ()
  • bool _M_valid_range (const _Safe_iterator &__rhs, std::pair< difference_type, _Distance_precision > &__dist, bool __check_dereferenceable=true) const
  • bool _M_value_initialized () const β€” is the iterator value-initialized?
  • constexpr const _Iterator & base () const noexcept
  • constexpr _Iterator & base () noexcept β€” return the underlying iterator.
  • constexpr operator _Iterator () const noexcept β€” conversion to underlying non-debug iterator to allow better interaction with non-debug containers.
  • constexpr reference operator* () const noexcept β€” iterator dereference.
  • constexpr _Safe_iterator & operator++ () noexcept β€” iterator preincrement.
  • constexpr _Safe_iterator operator++ (int) noexcept β€” iterator postincrement.
  • constexpr pointer operator-> () const noexcept β€” iterator dereference.
  • constexpr _Safe_iterator & operator= (_Safe_iterator &&__x) noexcept β€” move assignment.
  • constexpr _Safe_iterator & operator= (const _Safe_iterator &__x) noexcept β€” copy assignment.

🌟 Static Public Member Functions 🌟

  • static constexpr bool _S_constant () β€” determine if this is a constant iterator.

πŸ¦‹ Public Attributes πŸ¦‹

  • _Safe_iterator_base * _M_next
  • _Safe_iterator_base * _M_prior
  • _Safe_sequence_base * _M_sequence
  • unsigned int _M_version

πŸ”’ Protected Types πŸ”’

typedef std::__are_same< typename _Sequence::_Base::const_iterator,
    _Iterator > _IsConstant
typedef __gnu_cxx::__conditional_type< _IsConstant::__value,
    typename_Sequence::_Base::iterator,
    typename_Sequence::_Base::const_iterator >::__type _OtherIterator

🧚 Protected Member Functions 🧚

  • constexpr _Safe_iterator (const _Safe_iterator &__x, _Unchecked) noexcept
  • void _M_attach (_Safe_sequence_base *__seq, bool __constant)
  • void _M_attach_single (_Safe_sequence_base *__seq, bool __constant) throw ()
  • void _M_detach ()
  • __gnu_cxx::__mutex & _M_get_mutex () throw ()

🫢 Friends 🫢

template<typename _IteR > constexpr friend bool operator== (const _Self
    &__lhs, const _Safe_iterator< _IteR, _Sequence, iterator_category >
    &__rhs) noexcept
constexpr friend bool operator== (const _Self &__lhs, const _Self
    &__rhs) noexcept

🌈 Detailed Description 🌈

template<typename _Iterator, typename _Sequence, typename _Category =
    typename std::iterator_traits<_Iterator>::iterator_category>
class __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
>"Safe iterator wrapper.

Bestie, the class template _Safe_iterator is a wrapper around an iterator that tracks the iterator's movement among sequences and checks that operations performed on the 'safe' iterator are legal. it's literally the vibe check for your iterator πŸ‘‘

On top of the basic iterator operations (which are validated, and then passed to the underlying iterator), _Safe_iterator has member functions for iterator invalidation, attaching/detaching the iterator from sequences, and querying the iterator's state.

⚠️ Note that _Iterator must be the first base class so that it gets initialized before the iterator is being attached to the container's list of iterators and it is being detached before _Iterator get destroyed. Otherwise it would result in a data race. this part is serious, bestie β€” data race is not cute 😭

🧁 Constructor & Destructor Documentation 🧁

πŸ“ _Safe_iterator ()

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
>::_Safe_iterator () [inline],  [constexpr],  [noexcept]

Postcondition: the iterator is singular and unattached.

πŸ“ _Safe_iterator (_Iterator __i, const _Safe_sequence_base *__seq)

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
>::_Safe_iterator (_Iterator __i, const _Safe_sequence_base * __seq)
[inline],  [constexpr],  [noexcept]

Safe iterator construction from an unsafe iterator and its sequence.

Precondition: seq is not NULL.

Postcondition: this is not singular.

πŸ“ _Safe_iterator (const _Safe_iterator< _Iterator, _Sequence, _Category > & __x)

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
>::_Safe_iterator (const _Safe_iterator< _Iterator, _Sequence, _Category
> & __x) [inline],  [constexpr],  [noexcept]

Copy construction. copying, but make it safe πŸ’œ

References __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach(), __gnu_debug::_Safe_iterator_base::_M_sequence, __gnu_debug::_Safe_iterator_base::_M_singular(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized().

πŸ“ _Safe_iterator (_Safe_iterator< _Iterator, _Sequence, _Category > && __x)

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
>::_Safe_iterator (_Safe_iterator< _Iterator, _Sequence, _Category > &&
__x) [inline],  [constexpr],  [noexcept]

Move construction. yeet that iterator, but safely ✨

Postcondition: __x is singular and unattached.

References __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach(), __gnu_debug::_Safe_iterator_base::_M_detach(), __gnu_debug::_Safe_iterator_base::_M_sequence, __gnu_debug::_Safe_iterator_base::_M_singular(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base().

πŸ“ converting constructor from mutable iterator to constant iterator

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category>
template<typename _MutableIterator > constexpr
__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
>::_Safe_iterator (const _Safe_iterator< _MutableIterator, _Sequence,
typename __gnu_cxx::__enable_if< _IsConstant::__value &&std::__are_same<
_MutableIterator, _OtherIterator >::__value, _Category >::__type > &
__x) [inline],  [constexpr],  [noexcept]

Converting constructor from a mutable iterator to a constant iterator. glow-up from mutable to const, no cap πŸ¦‹

References __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach(), __gnu_debug::_Safe_iterator_base::_M_sequence, __gnu_debug::_Safe_iterator_base::_M_singular(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized().


🌺 Member Function Documentation 🌺

πŸ’« _M_attach (_Safe_sequence_base * __seq)

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> void
__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
>::_M_attach (_Safe_sequence_base * __seq) [inline]

Attach iterator to the given sequence. like adding yourself to the right group chat πŸ’–

References __gnu_debug::_Safe_iterator_base::_M_attach(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_S_constant().

Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=().

πŸ’« __gnu_debug::_Safe_iterator_base::_M_attach (_Safe_sequence_base * __seq, bool __constant)

void __gnu_debug::_Safe_iterator_base::_M_attach (_Safe_sequence_base *
__seq, bool __constant) [protected],  [inherited]

Attaches this iterator to the given sequence, detaching it from whatever sequence it was attached to originally. If the new sequence is the NULL pointer, the iterator is left unattached. switching friend groups but with pointer rules πŸ’œ

Referenced by __gnu_debug::_Safe_iterator_base::_Safe_iterator_base(), __gnu_debug::_Safe_iterator_base::_Safe_iterator_base(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach().

okay so this next chunk is the rest of the member functions β€” the protected ones, the ones inherited from _Safe_iterator_base, and all the little helper predicates that make debug iterators actually safe πŸ’… it's giving behind the scenes and honestly it ate.

template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> void __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach_single (_Safe_sequence_base * __seq) [inline]

Same deal as the normal attach, bestie, except this one is not thread-safe β€” so don't be sharing it across threads 😭

References: __gnu_debug::_Safe_iterator_base::_M_attach_single(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_S_constant().


void __gnu_debug::_Safe_iterator_base::_M_attach_single (_Safe_sequence_base * __seq, bool __constant) [protected], [inherited]

Again: same vibe, but not thread-safe. Zero thread safety, no cap.

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach_single().


bool __gnu_debug::_Safe_iterator_base::_M_attached_to (const _Safe_sequence_base * __seq) const [inline], [inherited]

Answers the question "are we attached to this specific sequence?" for the sequence you hand it πŸ‘€

References: __gnu_debug::_Safe_iterator_base::_M_sequence.


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_before_dereferenceable () const [inline]

Is this iterator sitting right before a dereferenceable one? basically "am I the one before the one you can actually dereference" 🧐

References: __gnu_debug::__base(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_incrementable(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base().


bool __gnu_debug::_Safe_iterator_base::_M_can_compare (const _Safe_iterator_base & __x) const [inherited]

Can we even compare this iterator to the iterator __x you passed? Returns true if both iterators are nonsingular and they reference the same sequence. if not, the library is gonna be like "girl what" πŸ’€


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_dereferenceable () const [inline]

Is the iterator dereferenceable? i.e. can you actually slap a * on it without the debug machinery losing its mind ✨

References: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_before_begin(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_end(), and __gnu_debug::_Safe_iterator_base::_M_singular().

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator*(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator->().


void __gnu_debug::_Safe_iterator_base::_M_detach () [protected], [inherited]

Detaches the iterator from whatever sequence it's currently attached to β€” if it's attached to any at all βœ‚οΈ

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=().


void __gnu_debug::_Safe_iterator_base::_M_detach_single () [inherited]

Yeah, same thing, but not thread-safe 🫢

Referenced by: __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_from_if().


__gnu_cxx::__mutex & __gnu_debug::_Safe_iterator_base::_M_get_mutex () [protected], [inherited]

This one exists for use in _Safe_iterator πŸ”

Referenced by: __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator++(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator++(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=(), __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=(), and __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=().


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_incrementable () const [inline]

Is the iterator incrementable? can we ++ it or is it gonna scream at us 🫣

References: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_end(), and __gnu_debug::_Safe_iterator_base::_M_singular().

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_before_dereferenceable(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator++(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator++().


void __gnu_debug::_Safe_iterator_base::_M_invalidate () [inline], [inherited]

Invalidates the iterator, which makes it singular β€” like, it no longer belongs to anybody πŸ’€ iconic but sad

References: __gnu_debug::_Safe_iterator_base::_M_version.


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_before_begin () const [inline]

Is this iterator equal to the sequence's before_begin() iterator, if the sequence even has one? πŸ‘€

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_dereferenceable().


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> constexpr bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_begin () const [inline], [constexpr]

Is this iterator equal to the sequence's begin() iterator? simple as 🌸

References: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base().


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_beginnest () const [inline]

Is this iterator equal to the sequence's before_begin() iterator if it has one, or begin() otherwise? it's the beginnest. the most begin to ever begin πŸŽ€


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_end () const [inline]

Is this iterator equal to the sequence's end() iterator? yep, that's the whole thing 🌈

References: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base().

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_dereferenceable(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_incrementable().


void __gnu_debug::_Safe_iterator_base::_M_reset () [inherited]

Resets all the member variables. factory reset core 🧼


bool __gnu_debug::_Safe_iterator_base::_M_singular () const [inherited]

Is this iterator singular? the big question 😭

Referenced by:

  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_Safe_local_iterator()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_Safe_local_iterator()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_Safe_local_iterator()
  • __gnu_debug::__check_singular_aux()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_dereferenceable()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_M_dereferenceable()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_incrementable()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_M_incrementable()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=()

void __gnu_debug::_Safe_iterator_base::_M_unlink () [inline], [inherited]

Unlinks itself. bye bestie πŸ‘‹ πŸ”—

References: __gnu_debug::_Safe_iterator_base::_M_next, and __gnu_debug::_Safe_iterator_base::_M_prior.


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized () const [inline]

Is the iterator value-initialized? checking the vibes of its initialization state πŸ”

References: __gnu_debug::_Safe_iterator_base::_M_version, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base().

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=().


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> static constexpr bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_S_constant () [inline], [static], [constexpr]

Works out whether this is a constant iterator. static, constexpr, adorable ⭐

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach_single().


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> constexpr _Iterator & __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base () [inline], [constexpr], [noexcept]

Hands you back the underlying iterator. that's it, that's the function β€” constexpr and noexcept included πŸ’–

Referenced by: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_before_dereferenceable(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_begin(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_is_end(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator*(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator++(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator->(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=().


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> constexpr __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator _Iterator () const [inline], [constexpr], [noexcept]

Conversion to the underlying non-debug iterator, so debug iterators can play nicely with non-debug containers. friendship bracelets, basically 🀝


template<typename _Iterator , typename _Sequence , typename _Category  = typename std::iterator_traits<_Iterator>::iterator_category> constexpr reference __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator* () const [inline], [constexpr], [noexcept]

Iterator dereference ✨ the moment we've all been waiting for ✨

okay so finishing up that dereference entry β€” the vibe check is:

  • Precondition: iterator is dereferenceable
  • References: __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_dereferenceable(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base().

preincrement core: operator++ ()

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
    _Safe_iterator & __gnu_debug::_Safe_iterator< _Iterator, _Sequence,
    _Category >::operator++ () [inline],  [constexpr],  [noexcept]

Iterator preincrement β€” literally bumping the iterator forward, bestie. It’s giving β€œone step to the right” energy.

  • Precondition: iterator is incrementable
  • References:
    • __gnu_debug::_Safe_iterator_base::_M_get_mutex()
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_incrementable()
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base()

postincrement era: operator++ (int)

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
    _Safe_iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence,
    _Category >::operator++ (int) [inline],  [constexpr],  [noexcept]

Iterator postincrement β€” same forward-bump fantasy, but the (int) flavor.

  • Precondition: iterator is incrementable
  • References:
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_incrementable()

arrow moment: operator-> ()

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
    pointer __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category
    >::operator-> () const [inline],  [constexpr],  [noexcept]

Iterator dereference β€” it hands you a pointer, no cap.

  • Precondition: iterator is dereferenceable
  • References:
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_dereferenceable()
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base()

move assignment: operator= (_Safe_iterator &&)

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
    _Safe_iterator & __gnu_debug::_Safe_iterator< _Iterator, _Sequence,
    _Category >::operator= (_Safe_iterator< _Iterator, _Sequence, _Category
    > && __x) [inline],  [constexpr],  [noexcept]

Move assignment. Shifting the whole iterator situation over to __x’s old spot.

  • Postcondition: __x is singular and unattached
  • References:
    • std::__addressof()
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach()
    • __gnu_debug::_Safe_iterator_base::_M_detach()
    • __gnu_debug::_Safe_iterator_base::_M_get_mutex()
    • __gnu_debug::_Safe_iterator_base::_M_sequence
    • __gnu_debug::_Safe_iterator_base::_M_singular()
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized()
    • __gnu_debug::_Safe_iterator_base::_M_version
    • __gnu_debug::_Safe_sequence_base::_M_version
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base()

copy assignment: operator= (const _Safe_iterator &)

template<typename _Iterator , typename _Sequence , typename _Category  =
    typename std::iterator_traits<_Iterator>::iterator_category> constexpr
    _Safe_iterator & __gnu_debug::_Safe_iterator< _Iterator, _Sequence,
    _Category >::operator= (const _Safe_iterator< _Iterator, _Sequence,
    _Category > & __x) [inline],  [constexpr],  [noexcept]

Copy assignment. Same assignment energy, but copied instead of moved.

  • References:
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_attach()
    • __gnu_debug::_Safe_iterator_base::_M_detach()
    • __gnu_debug::_Safe_iterator_base::_M_get_mutex()
    • __gnu_debug::_Safe_iterator_base::_M_sequence
    • __gnu_debug::_Safe_iterator_base::_M_singular()
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized()
    • __gnu_debug::_Safe_iterator_base::_M_version
    • __gnu_debug::_Safe_sequence_base::_M_version
    • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::base()

🌸 Member Data Documentation 🌸

_Safe_iterator_base* __gnu_debug::_Safe_iterator_base::_M_next [inherited]

Pointer to the next iterator in the sequence’s list of iterators. Only valid when _M_sequence != NULL β€” so don’t go touching it when the sequence is a whole NULL situation, bestie.

Referenced by:

  • __gnu_debug::_Safe_sequence< _SafeSequence >::_M_invalidate_if()
  • __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_from_if()
  • __gnu_debug::_Safe_iterator_base::_M_unlink()

_Safe_iterator_base* __gnu_debug::_Safe_iterator_base::_M_prior [inherited]

Pointer to the previous iterator in the sequence’s list of iterators. Only valid when _M_sequence != NULL β€” same rule, previous-side edition.

Referenced by:

  • __gnu_debug::_Safe_sequence< _SafeSequence >::_M_invalidate_if()
  • __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_from_if()
  • __gnu_debug::_Safe_iterator_base::_M_unlink()

_Safe_sequence_base* __gnu_debug::_Safe_iterator_base::_M_sequence [inherited]

The sequence this iterator references; may be NULL to indicate a singular iterator. iconic little β€œam I attached or not?” flag, honestly.

Referenced by:

  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator()
  • __gnu_debug::_Safe_iterator_base::_Safe_iterator_base()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_Safe_local_iterator()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_Safe_local_iterator()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_Safe_local_iterator()
  • __gnu_debug::_Safe_local_iterator_base::_Safe_local_iterator_base()
  • __gnu_debug::_Safe_iterator_base::_M_attached_to()
  • __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_from_if()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=()

unsigned int __gnu_debug::_Safe_iterator_base::_M_version [inherited]

The version number of this iterator. The sentinel value 0 is used to indicate an invalidated iterator (i.e., one that is singular because of an operation on the container). This version number must equal the version number in the sequence referenced by _M_sequence for the iterator to be non-singular. so yes, the version check is literally the whole personality here.

Referenced by:

  • __gnu_debug::_Safe_iterator_base::_M_invalidate()
  • __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_from_if()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_M_value_initialized()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::_M_value_initialized()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=()
  • __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::operator=()
  • __gnu_debug::_Safe_local_iterator< _Iterator, _Sequence >::operator=()

🫢 Author 🫢

Generated automatically by Doxygen for libstdc++ from the source code.


and that’s the whole page, bestie 🫢 β€” huge slay to libstdc++ and the source/version + date stamped in the footer, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from