#include <safe_iterator.h>
Inheritance diagram for __gnu_debug::_Safe_iterator< _Iterator, _Sequence >:
Public Types | |
typedef _Iterator | _Base_iterator |
typedef _Traits::iterator_category | iterator_category |
typedef _Traits::value_type | value_type |
typedef _Traits::difference_type | difference_type |
typedef _Traits::reference | reference |
typedef _Traits::pointer | pointer |
Public Member Functions | |
_Safe_iterator () | |
_Safe_iterator (const _Iterator &__i, const _Sequence *__seq) | |
Safe iterator construction from an unsafe iterator and its sequence. | |
_Safe_iterator (const _Safe_iterator &__x) | |
Copy construction. | |
template<typename _MutableIterator> | |
_Safe_iterator (const _Safe_iterator< _MutableIterator, typename std::__enable_if< _Sequence,(std::__are_same< _MutableIterator, typename _Sequence::iterator::_Base_iterator >::__value) >::__type > &__x) | |
Converting constructor from a mutable iterator to a constant iterator. | |
_Safe_iterator & | operator= (const _Safe_iterator &__x) |
Copy assignment. | |
reference | operator * () const |
Iterator dereference. | |
pointer | operator-> () const |
Iterator dereference. | |
_Safe_iterator & | operator++ () |
Iterator preincrement. | |
_Safe_iterator | operator++ (int) |
Iterator postincrement. | |
_Safe_iterator & | operator-- () |
Iterator predecrement. | |
_Safe_iterator | operator-- (int) |
Iterator postdecrement. | |
reference | operator[] (const difference_type &__n) const |
_Safe_iterator & | operator+= (const difference_type &__n) |
_Safe_iterator | operator+ (const difference_type &__n) const |
_Safe_iterator & | operator-= (const difference_type &__n) |
_Safe_iterator | operator- (const difference_type &__n) const |
_Iterator | base () const |
Return the underlying iterator. | |
operator _Iterator () const | |
Conversion to underlying non-debug iterator to allow better interaction with non-debug containers. | |
void | _M_attach (const _Sequence *__seq) |
void | _M_invalidate () |
bool | _M_dereferenceable () const |
Is the iterator dereferenceable? | |
bool | _M_incrementable () const |
Is the iterator incrementable? | |
bool | _M_decrementable () const |
bool | _M_can_advance (const difference_type &__n) const |
template<typename _Other> | |
bool | _M_valid_range (const _Safe_iterator< _Other, _Sequence > &__rhs) const |
const _Sequence * | _M_get_sequence () const |
bool | _M_is_begin () const |
Is this iterator equal to the sequence's begin() iterator? | |
bool | _M_is_end () const |
Is this iterator equal to the sequence's end() iterator? | |
Static Public Member Functions | |
template<typename _Iterator1, typename _Iterator2> | |
static pair< difference_type, _Distance_precision > | _M_get_distance (const _Iterator1 &__lhs, const _Iterator2 &__rhs) |
template<typename _Iterator1, typename _Iterator2> | |
static pair< difference_type, _Distance_precision > | _M_get_distance (const _Iterator1 &__lhs, const _Iterator2 &__rhs, std::random_access_iterator_tag) |
template<typename _Iterator1, typename _Iterator2> | |
static pair< difference_type, _Distance_precision > | _M_get_distance (const _Iterator1 &__lhs, const _Iterator2 &__rhs, std::forward_iterator_tag) |
Private Types | |
typedef _Safe_iterator | _Self |
typedef iterator_traits< _Iterator > | _Traits |
__dp_equality | |
__dp_sign | |
__dp_exact | |
enum | _Distance_precision { __dp_equality, __dp_sign, __dp_exact } |
Private Member Functions | |
bool | _M_constant () const |
Determine if this is a constant iterator. | |
Private Attributes | |
_Iterator | _M_current |
The underlying iterator. |
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.
Definition at line 67 of file safe_iterator.h.
typedef _Iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_Base_iterator |
Definition at line 95 of file safe_iterator.h.
typedef _Safe_iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_Self [private] |
Definition at line 69 of file safe_iterator.h.
typedef iterator_traits<_Iterator> __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_Traits [private] |
Definition at line 92 of file safe_iterator.h.
typedef _Traits::difference_type __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::difference_type |
Definition at line 98 of file safe_iterator.h.
typedef _Traits::iterator_category __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::iterator_category |
Definition at line 96 of file safe_iterator.h.
typedef _Traits::pointer __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::pointer |
Definition at line 100 of file safe_iterator.h.
typedef _Traits::reference __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::reference |
Definition at line 99 of file safe_iterator.h.
typedef _Traits::value_type __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::value_type |
Definition at line 97 of file safe_iterator.h.
enum __gnu_debug::_Safe_iterator::_Distance_precision [private] |
The precision to which we can calculate the distance between two iterators.
Definition at line 74 of file safe_iterator.h.
__gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_Safe_iterator | ( | ) | [inline] |
Definition at line 103 of file safe_iterator.h.
__gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_Safe_iterator | ( | const _Iterator & | __i, | |
const _Sequence * | __seq | |||
) | [inline] |
Safe iterator construction from an unsafe iterator and its sequence.
seq
is not NULL Definition at line 112 of file safe_iterator.h.
References __gnu_debug::__msg_init_singular, and _GLIBCXX_DEBUG_VERIFY.
__gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_Safe_iterator | ( | const _Safe_iterator< _Iterator, _Sequence > & | __x | ) | [inline] |
Copy construction.
x
is not singular Definition at line 124 of file safe_iterator.h.
References __gnu_debug::__msg_init_copy_singular, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator_base::_M_singular().
__gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_Safe_iterator | ( | const _Safe_iterator< _MutableIterator, typename std::__enable_if< _Sequence,(std::__are_same< _MutableIterator, typename _Sequence::iterator::_Base_iterator >::__value) >::__type > & | __x | ) | [inline] |
Converting constructor from a mutable iterator to a constant iterator.
x
is not singular Definition at line 140 of file safe_iterator.h.
References __gnu_debug::__msg_init_const_singular, and _GLIBCXX_DEBUG_VERIFY.
void __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_attach | ( | const _Sequence * | __seq | ) | [inline] |
Attach iterator to the given sequence.
Definition at line 323 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator_base::_M_attach(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_constant().
Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator=().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_can_advance | ( | const difference_type & | __n | ) | const |
Definition at line 44 of file safe_iterator.tcc.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::__dp_exact, __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_get_distance(), __gnu_debug::_Safe_iterator_base::_M_sequence, std::pair< _T1, _T2 >::first, and std::pair< _T1, _T2 >::second.
Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator[]().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_constant | ( | ) | const [inline, private] |
Determine if this is a constant iterator.
Definition at line 86 of file safe_iterator.h.
Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_attach().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_decrementable | ( | ) | const [inline] |
Definition at line 344 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_is_begin(), and __gnu_debug::_Safe_iterator_base::_M_singular().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_dereferenceable | ( | ) | const [inline] |
Is the iterator dereferenceable?
Definition at line 335 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_is_end(), and __gnu_debug::_Safe_iterator_base::_M_singular().
Referenced by __gnu_debug::__check_dereferenceable(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_incrementable(), and __gnu_debug_def::list< _Tp, _Allocator >::splice().
static pair<difference_type, _Distance_precision> __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_get_distance | ( | const _Iterator1 & | __lhs, | |
const _Iterator2 & | __rhs, | |||
std::forward_iterator_tag | ||||
) | [inline, static] |
Definition at line 382 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::__dp_equality, and std::make_pair().
static pair<difference_type, _Distance_precision> __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_get_distance | ( | const _Iterator1 & | __lhs, | |
const _Iterator2 & | __rhs, | |||
std::random_access_iterator_tag | ||||
) | [inline, static] |
Definition at line 374 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::__dp_exact, and std::make_pair().
static pair<difference_type, _Distance_precision> __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_get_distance | ( | const _Iterator1 & | __lhs, | |
const _Iterator2 & | __rhs | |||
) | [inline, static] |
Determine the distance between two iterators with some known precision.
Definition at line 365 of file safe_iterator.h.
Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_can_advance(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_valid_range().
const _Sequence* __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_get_sequence | ( | ) | const [inline] |
Definition at line 357 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator_base::_M_sequence.
Referenced by __gnu_debug::_Error_formatter::_Parameter::_Parameter().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_incrementable | ( | ) | const [inline] |
Is the iterator incrementable?
Definition at line 340 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_dereferenceable().
void __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_invalidate | ( | ) |
Invalidate the iterator, making it singular.
Definition at line 112 of file safe_iterator.tcc.
References __gnu_debug::_Safe_sequence_base::_M_const_iterators, __gnu_debug::_Safe_sequence_base::_M_iterators, __gnu_debug::_Safe_iterator_base::_M_sequence, and __gnu_debug::_Safe_iterator_base::_M_version.
Referenced by __gnu_debug_def::set< _Key, _Compare, _Allocator >::erase(), __gnu_debug_def::multiset< _Key, _Compare, _Allocator >::erase(), __gnu_debug_def::multimap< _Key, _Tp, _Compare, _Allocator >::erase(), __gnu_debug_def::map< _Key, _Tp, _Compare, _Allocator >::erase(), __gnu_debug_def::list< _Tp, _Allocator >::erase(), __gnu_debug_def::hash_set< _Value, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::hash_multiset< _Value, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::hash_multimap< _Value, _Tp, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::hash_map< _Value, _Tp, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::deque< _Tp, _Allocator >::erase(), __gnu_debug_def::vector< _Tp, _Allocator >::pop_back(), __gnu_debug_def::list< _Tp, _Allocator >::pop_back(), __gnu_debug_def::deque< _Tp, _Allocator >::pop_back(), __gnu_debug_def::list< _Tp, _Allocator >::pop_front(), __gnu_debug_def::deque< _Tp, _Allocator >::pop_front(), and __gnu_debug_def::list< _Tp, _Allocator >::resize().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_is_begin | ( | ) | const [inline] |
Is this iterator equal to the sequence's begin() iterator?
Definition at line 390 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator_base::_M_sequence.
Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_decrementable(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_valid_range(), and __gnu_debug::_Error_formatter::_Parameter::_Parameter().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_is_end | ( | ) | const [inline] |
Is this iterator equal to the sequence's end() iterator?
Definition at line 394 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator_base::_M_sequence.
Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_dereferenceable(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_valid_range(), and __gnu_debug::_Error_formatter::_Parameter::_Parameter().
bool __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_valid_range | ( | const _Safe_iterator< _Other, _Sequence > & | __rhs | ) | const |
Definition at line 78 of file safe_iterator.tcc.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::__dp_equality, __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::__dp_exact, __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::__dp_sign, __gnu_debug::_Safe_iterator_base::_M_can_compare(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_get_distance(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_is_begin(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_is_end(), std::pair< _T1, _T2 >::first, and std::pair< _T1, _T2 >::second.
Referenced by __gnu_debug::__valid_range().
_Iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::base | ( | ) | const [inline] |
Return the underlying iterator.
Definition at line 313 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
Referenced by __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_iter(), __gnu_debug_def::vector< _Tp, _Allocator >::erase(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::erase(), __gnu_debug_def::set< _Key, _Compare, _Allocator >::erase(), __gnu_debug_def::multiset< _Key, _Compare, _Allocator >::erase(), __gnu_debug_def::multimap< _Key, _Tp, _Compare, _Allocator >::erase(), __gnu_debug_def::map< _Key, _Tp, _Compare, _Allocator >::erase(), __gnu_debug_def::list< _Tp, _Allocator >::erase(), __gnu_debug_def::hash_set< _Value, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::hash_multiset< _Value, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::hash_multimap< _Value, _Tp, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::hash_map< _Value, _Tp, _HashFcn, _EqualKey, _Alloc >::erase(), __gnu_debug_def::deque< _Tp, _Allocator >::erase(), __gnu_debug_def::vector< _Tp, _Allocator >::insert(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::insert(), __gnu_debug_def::set< _Key, _Compare, _Allocator >::insert(), __gnu_debug_def::multiset< _Key, _Compare, _Allocator >::insert(), __gnu_debug_def::multimap< _Key, _Tp, _Compare, _Allocator >::insert(), __gnu_debug_def::map< _Key, _Tp, _Compare, _Allocator >::insert(), __gnu_debug_def::list< _Tp, _Allocator >::insert(), __gnu_debug_def::deque< _Tp, _Allocator >::insert(), __gnu_debug_def::list< _Tp, _Allocator >::merge(), __gnu_debug::operator!=(), __gnu_debug::operator-(), __gnu_debug::operator==(), __gnu_debug::operator>(), __gnu_debug::operator>=(), __gnu_debug_def::list< _Tp, _Allocator >::remove(), __gnu_debug_def::list< _Tp, _Allocator >::remove_if(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::replace(), and __gnu_debug_def::list< _Tp, _Allocator >::splice().
reference __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator * | ( | ) | const [inline] |
Iterator dereference.
Definition at line 176 of file safe_iterator.h.
References __gnu_debug::__msg_bad_deref, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
__gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator _Iterator | ( | ) | const [inline] |
Conversion to underlying non-debug iterator to allow better interaction with non-debug containers.
Definition at line 319 of file safe_iterator.h.
References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Safe_iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator+ | ( | const difference_type & | __n | ) | const [inline] |
Definition at line 283 of file safe_iterator.h.
_Safe_iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator++ | ( | int | ) | [inline] |
Iterator postincrement.
Definition at line 220 of file safe_iterator.h.
References __gnu_debug::__msg_bad_inc, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Safe_iterator& __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator++ | ( | ) | [inline] |
Iterator preincrement.
Definition at line 206 of file safe_iterator.h.
References __gnu_debug::__msg_bad_inc, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Safe_iterator& __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator+= | ( | const difference_type & | __n | ) | [inline] |
Definition at line 273 of file safe_iterator.h.
References __gnu_debug::__msg_advance_oob, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Safe_iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator- | ( | const difference_type & | __n | ) | const [inline] |
Definition at line 301 of file safe_iterator.h.
_Safe_iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator-- | ( | int | ) | [inline] |
Iterator postdecrement.
Definition at line 250 of file safe_iterator.h.
References __gnu_debug::__msg_bad_dec, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Safe_iterator& __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator-- | ( | ) | [inline] |
Iterator predecrement.
Definition at line 236 of file safe_iterator.h.
References __gnu_debug::__msg_bad_dec, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Safe_iterator& __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator-= | ( | const difference_type & | __n | ) | [inline] |
Definition at line 291 of file safe_iterator.h.
References __gnu_debug::__msg_retreat_oob, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
pointer __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator-> | ( | ) | const [inline] |
Iterator dereference.
Use addressof() instead of & operator
Definition at line 192 of file safe_iterator.h.
References __gnu_debug::__msg_bad_deref, _GLIBCXX_DEBUG_VERIFY, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Safe_iterator& __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator= | ( | const _Safe_iterator< _Iterator, _Sequence > & | __x | ) | [inline] |
Copy assignment.
x
is not singular Definition at line 160 of file safe_iterator.h.
References __gnu_debug::__msg_copy_singular, _GLIBCXX_DEBUG_VERIFY, __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_attach(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current, __gnu_debug::_Safe_iterator_base::_M_sequence, and __gnu_debug::_Safe_iterator_base::_M_singular().
reference __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator[] | ( | const difference_type & | __n | ) | const [inline] |
Definition at line 262 of file safe_iterator.h.
References __gnu_debug::__msg_iter_subscript_oob, _GLIBCXX_DEBUG_VERIFY, __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_can_advance(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current.
_Iterator __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_current [private] |
The underlying iterator.
Definition at line 82 of file safe_iterator.h.
Referenced by __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::base(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator *(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator _Iterator(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator++(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator+=(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator--(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator-=(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator->(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator=(), and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::operator[]().