===================================================================
@@ -38,7 +38,7 @@
using std::type_info;
template<typename _Iterator>
- bool __check_singular(_Iterator&);
+ bool __check_singular(const _Iterator&);
class _Safe_sequence_base;
===================================================================
@@ -45,20 +45,19 @@
template<typename _Iterator, typename _Sequence>
class _Safe_iterator;
+ template<typename _Iterator, typename _Sequence>
+ class _Safe_local_iterator;
+
template<typename _Sequence>
struct _Insert_range_from_self_is_safe
{ enum { __value = 0 }; };
- // An arbitrary iterator pointer is not singular.
- inline bool
- __check_singular_aux(const void*) { return false; }
-
- // We may have an iterator that derives from _Safe_iterator_base but isn't
- // a _Safe_iterator.
+ /** Assume that some arbitrary iterator is not singular, because we
+ can't prove that it is. */
template<typename _Iterator>
inline bool
- __check_singular(_Iterator& __x)
- { return __check_singular_aux(&__x); }
+ __check_singular(const _Iterator& __x)
+ { return false; }
/** Non-NULL pointers are nonsingular. */
template<typename _Tp>
@@ -66,17 +65,11 @@
__check_singular(const _Tp* __ptr)
{ return __ptr == 0; }
- /** Safe iterators know if they are singular. */
- template<typename _Iterator, typename _Sequence>
- inline bool
- __check_singular(const _Safe_iterator<_Iterator, _Sequence>& __x)
- { return __x._M_singular(); }
-
/** Assume that some arbitrary iterator is dereferenceable, because we
can't prove that it isn't. */
template<typename _Iterator>
inline bool
- __check_dereferenceable(_Iterator&)
+ __check_dereferenceable(const _Iterator&)
{ return true; }
/** Non-NULL pointers are dereferenceable. */
@@ -85,12 +78,19 @@
__check_dereferenceable(const _Tp* __ptr)
{ return __ptr; }
- /** Safe iterators know if they are singular. */
+ /** Safe iterators know if they are dereferenceable. */
template<typename _Iterator, typename _Sequence>
inline bool
__check_dereferenceable(const _Safe_iterator<_Iterator, _Sequence>& __x)
{ return __x._M_dereferenceable(); }
+ /** Safe local iterators know if they are dereferenceable. */
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ __check_dereferenceable(const _Safe_local_iterator<_Iterator,
+ _Sequence>& __x)
+ { return __x._M_dereferenceable(); }
+
/** If the distance between two random access iterators is
* nonnegative, assume the range is valid.
*/
===================================================================
@@ -56,13 +56,10 @@
{ return __it == __seq->_M_base().begin(); }
};
- /** Iterators that derive from _Safe_iterator_base but that aren't
- * _Safe_iterators can be determined singular or non-singular via
- * _Safe_iterator_base.
- */
- inline bool
- __check_singular_aux(const _Safe_iterator_base* __x)
- { return __x->_M_singular(); }
+ /** _Safe_iterators can be determined singular or non-singular. */
+ inline bool
+ __check_singular(const _Safe_iterator_base& __x)
+ { return __x._M_singular(); }
/** The precision to which we can calculate the distance between
* two iterators.