diff options
| author | fdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-25 19:25:06 +0000 |
|---|---|---|
| committer | fdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-25 19:25:06 +0000 |
| commit | 4ba9199af5fa3a195dc6570728aaabe08f7e9e62 (patch) | |
| tree | 0212c21d62f4588f1e1f1669029c64397a6f945a /libstdc++-v3/include/debug | |
| parent | e62fd5b8408477cf8cae45a7547dd2166bc9a0a1 (diff) | |
| download | ppe42-gcc-4ba9199af5fa3a195dc6570728aaabe08f7e9e62.tar.gz ppe42-gcc-4ba9199af5fa3a195dc6570728aaabe08f7e9e62.zip | |
2013-10-25 François Dumont <fdumont@gcc.gnu.org>
* include/debug/formatter.h (__check_singular): Add const on
iterator reference.
* include/debug/functions.h (__check_singular): Likewise.
(__check_singular(const _Safe_iterator<_Ite, _Seq>&)): Delete.
(__check_dereferenceable(const _Ite&)): Add const on iterator
reference.
(__check_dereferenceable(const _Safe_local_iterator<>&)): New.
* include/debug/safe_iterator.h (__check_singular_aux): Review
comment.
* testsuite/23_containers/vector/debug/debug_functions.cc: New.
* testsuite/23_containers/unordered_set/debug/debug_functions.cc:
New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204075 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug')
| -rw-r--r-- | libstdc++-v3/include/debug/formatter.h | 2 | ||||
| -rw-r--r-- | libstdc++-v3/include/debug/functions.h | 22 | ||||
| -rw-r--r-- | libstdc++-v3/include/debug/safe_iterator.h | 7 |
3 files changed, 17 insertions, 14 deletions
diff --git a/libstdc++-v3/include/debug/formatter.h b/libstdc++-v3/include/debug/formatter.h index 15dd8d73797..2af169b13fc 100644 --- a/libstdc++-v3/include/debug/formatter.h +++ b/libstdc++-v3/include/debug/formatter.h @@ -38,7 +38,7 @@ namespace __gnu_debug using std::type_info; template<typename _Iterator> - bool __check_singular(_Iterator&); + bool __check_singular(const _Iterator&); class _Safe_sequence_base; diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h index 8e76b7f2ee5..4d8fe21719c 100644 --- a/libstdc++-v3/include/debug/functions.h +++ b/libstdc++-v3/include/debug/functions.h @@ -45,6 +45,9 @@ namespace __gnu_debug 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 }; }; @@ -57,7 +60,7 @@ namespace __gnu_debug // a _Safe_iterator. template<typename _Iterator> inline bool - __check_singular(_Iterator& __x) + __check_singular(const _Iterator& __x) { return __check_singular_aux(&__x); } /** Non-NULL pointers are nonsingular. */ @@ -66,17 +69,11 @@ namespace __gnu_debug __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 +82,19 @@ namespace __gnu_debug __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. */ diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index d5adefd0ace..9e73bcfd985 100644 --- a/libstdc++-v3/include/debug/safe_iterator.h +++ b/libstdc++-v3/include/debug/safe_iterator.h @@ -56,10 +56,9 @@ namespace __gnu_debug { 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. - */ + /** Iterators that derive from _Safe_iterator_base can be determined singular + * or non-singular. + **/ inline bool __check_singular_aux(const _Safe_iterator_base* __x) { return __x->_M_singular(); } |

