libstdc++
__gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category > Class Template Reference

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
 
using iterator_concept = std::__detail::__iter_concept< _Iterator >
 
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
 
constexpr _Safe_iterator (_Safe_iterator &&__x) noexcept
 
constexpr _Safe_iterator (const _Safe_iterator &__x) noexcept
 
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
 
void _M_attach (const _Safe_sequence_base *__seq)
 
void _M_attach_single (const _Safe_sequence_base *__seq)
 
bool _M_before_dereferenceable () const
 
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_dereferenceable () const
 
_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
 
bool _M_is_before_begin () const
 
constexpr bool _M_is_begin () const
 
bool _M_is_beginnest () const
 
bool _M_is_end () const
 
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
 
constexpr const _Iterator & base () const noexcept
 
constexpr _Iterator & base () noexcept
 
constexpr operator _Iterator () const noexcept
 
constexpr reference operator* () const noexcept
 
constexpr _Safe_iteratoroperator++ () noexcept
 
constexpr _Safe_iterator operator++ (int) noexcept
 
constexpr pointer operator-> () const noexcept
 
constexpr _Safe_iteratoroperator= (_Safe_iterator &&__x) noexcept
 
constexpr _Safe_iteratoroperator= (const _Safe_iterator &__x) noexcept
 

Static Public Member Functions

static constexpr bool _S_constant ()
 

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
 

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.

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. In additional to 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.

Definition at line 62 of file boost_concept_check.h.

Constructor & Destructor Documentation

◆ _Safe_iterator() [1/5]

template<typename _Iterator , typename _Sequence , typename _Category = typename std::iterator_traits<_Iterator>::iterator_category>
constexpr __gnu_debug::_Safe_iterator< _Iterator, _Sequence, _Category >::_Safe_iterator ( )
inlineconstexprnoexcept
Postcondition
the iterator is singular and unattached

Definition at line 172 of file safe_iterator.h.

◆ _Safe_iterator() [2/5]

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 
)
inlineconstexprnoexcept

Safe iterator construction from an unsafe iterator and its sequence.

Precondition
seq is not NULL
Postcondition
this is not singular

Definition at line 182 of file safe_iterator.h.

◆ _Safe_iterator() [3/5]

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)
inlineconstexprnoexcept

Copy construction.

Definition at line 191 of file safe_iterator.h.

◆ _Safe_iterator() [4/5]

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)
inlineconstexprnoexcept

Move construction.

Postcondition
__x is singular and unattached

Definition at line 213 of file safe_iterator.h.

◆ _Safe_iterator() [5/5]

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)
inlineconstexprnoexcept

Converting constructor from a mutable iterator to a constant iterator.

Definition at line 240 of file safe_iterator.h.

Member Function Documentation

◆ _M_attach()

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

Attach iterator to the given sequence.

Definition at line 448 of file safe_iterator.h.

◆ _M_attach_single()

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 ( const _Safe_sequence_base __seq)
inline

Likewise, but not thread-safe.

Definition at line 453 of file safe_iterator.h.

◆ _M_before_dereferenceable()

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 the iterator before a dereferenceable one?

Definition at line 463 of file safe_iterator.h.

◆ _M_dereferenceable()

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?

Definition at line 458 of file safe_iterator.h.

◆ _M_incrementable()

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

◆ _M_is_before_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_before_begin ( ) const
inline

Is this iterator equal to the sequence's before_begin() iterator if any?

Definition at line 537 of file safe_iterator.h.

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

◆ _M_is_begin()

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
inlineconstexpr

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

Definition at line 526 of file safe_iterator.h.

◆ _M_is_beginnest()

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 any or begin() otherwise?

Definition at line 543 of file safe_iterator.h.

◆ _M_is_end()

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

◆ _M_value_initialized()

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?

Definition at line 480 of file safe_iterator.h.

◆ _S_constant()

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 ( )
inlinestaticconstexpr

◆ base()

◆ operator _Iterator()

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
inlineconstexprnoexcept

Conversion to underlying non-debug iterator to allow better interaction with non-debug containers.

Definition at line 444 of file safe_iterator.h.

◆ operator*()

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
inlineconstexprnoexcept

Iterator dereference.

Precondition
iterator is dereferenceable

Definition at line 348 of file safe_iterator.h.

◆ operator++() [1/2]

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++ ( )
inlineconstexprnoexcept

Iterator preincrement.

Precondition
iterator is incrementable

Definition at line 384 of file safe_iterator.h.

◆ operator++() [2/2]

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  )
inlineconstexprnoexcept

Iterator postincrement.

Precondition
iterator is incrementable

Definition at line 408 of file safe_iterator.h.

◆ 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
inlineconstexprnoexcept

Iterator dereference.

Precondition
iterator is dereferenceable

Definition at line 366 of file safe_iterator.h.

◆ operator=() [1/2]

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)
inlineconstexprnoexcept

Move assignment.

Postcondition
__x is singular and unattached

Definition at line 305 of file safe_iterator.h.

◆ operator=() [2/2]

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)
inlineconstexprnoexcept

Copy assignment.

Definition at line 266 of file safe_iterator.h.


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