aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/debug/functions.h
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2015-06-29 20:17:56 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2015-06-29 20:17:56 +0000
commit24167c42e62564c28c3e1e1159ee78ee6a52a86f (patch)
tree09a2a458cb2e7de403de7795dba0f8d97bab090f /libstdc++-v3/include/debug/functions.h
parent755c71faf3932e6febceb1dca4fbd448a00cc427 (diff)
downloadgcc-24167c42e62564c28c3e1e1159ee78ee6a52a86f.zip
gcc-24167c42e62564c28c3e1e1159ee78ee6a52a86f.tar.gz
gcc-24167c42e62564c28c3e1e1159ee78ee6a52a86f.tar.bz2
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org> * include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode. * include/debug/functions.h (__gnu_debug::__valid_range, __gnu_debug::__base): Move... * include/debug/safe_iterator.h (__gnu_debug::_Sequence_traits): New. (__gnu_debug::__get_distance_from_begin): New. (__gnu_debug::__get_distance_to_end): New. (__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range distance information. Add optional check_dereferenceable parameter, default true. (__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move default definition... (__gnu_debug::__get_distance): New overload for _Safe_iterator. (__gnu_debug::__unsafe): Likewise. * include/debug/helper_functions.h: ...here. New. (__gnu_debug::__unsafe): New helper function to remove safe iterator layer. * include/debug/stl_iterator.h: New. Include latter. * include/bits/stl_iterator.h: Include latter in debug mode. * include/debug/stl_iterator.tcc: Adapt. * include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add overload for _Safe_local_iterator. (__gnu_debug::__unsafe): Likewise. * include/debug/safe_local_iterator.tcc: Adapt. * include/debug/macros.h (__glibcxx_check_valid_range2): New. (__glibcxx_check_insert_range): Add _Dist parameter. (__glibcxx_check_insert_range_after): Likewise. (__glibcxx_check_string, __glibcxx_check_string_len): Implement using _GLIBCXX_DEBUG_PEDASSERT. * include/debug/deque (deque<>::assign): Remove iterator debug layer when possible. (deque<>::insert): Likewise. * include/debug/forward_list (__glibcxx_check_valid_fl_range): New. (forward_list<>::splice_after): Use latter. (forward_list<>::assign): Remove iterator debug layer when possible. (forward_list<>::insert_after): Likewise. (__gnu_debug::_Sequence_traits<>): Partial specialization. * include/debug/list (list<>::assign): Remove iterator debug layer when possible. (list<>::insert): Likewise. [__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI. * include/debug/map.h (map<>::insert): Remove iterator debug layer when possible. * include/debug/multimap.h (multimap<>::insert): Likewise. * include/debug/set.h (set<>::insert): Likewise. * include/debug/multiset.h (multiset<>::insert): Likewise. * include/debug/string (basic_string<>::append, basic_string<>::assign, basic_string<>::insert, basic_string<>::replace): Likewise. * include/debug/unordered_map (unordered_map<>::insert, unordered_multimap<>::insert): Likewise. * include/debug/unordered_set (unordered_set<>::insert, unordered_multiset<>insert): Likewise. * include/debug/vector (vector<>::assign, vector<>::insert): Likewise. * include/Makefile.am: Add new debug headers. * include/Makefile.in: Regenerate. From-SVN: r225143
Diffstat (limited to 'libstdc++-v3/include/debug/functions.h')
-rw-r--r--libstdc++-v3/include/debug/functions.h81
1 files changed, 1 insertions, 80 deletions
diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h
index bf60ccc..7f0659f 100644
--- a/libstdc++-v3/include/debug/functions.h
+++ b/libstdc++-v3/include/debug/functions.h
@@ -29,11 +29,6 @@
#ifndef _GLIBCXX_DEBUG_FUNCTIONS_H
#define _GLIBCXX_DEBUG_FUNCTIONS_H 1
-#include <bits/c++config.h>
-#include <bits/stl_iterator_base_types.h> // for iterator_traits,
- // categories and _Iter_base
-#include <bits/cpp_type_traits.h> // for __is_integer
-
#include <bits/move.h> // for __addressof
#include <bits/stl_function.h> // for less
#if __cplusplus >= 201103L
@@ -41,6 +36,7 @@
// conditional.
#endif
+#include <debug/helper_functions.h>
#include <debug/formatter.h>
namespace __gnu_debug
@@ -85,58 +81,6 @@ namespace __gnu_debug
__check_dereferenceable(const _Tp* __ptr)
{ return __ptr; }
- /** If the distance between two random access iterators is
- * nonnegative, assume the range is valid.
- */
- template<typename _RandomAccessIterator>
- inline bool
- __valid_range_aux2(const _RandomAccessIterator& __first,
- const _RandomAccessIterator& __last,
- std::random_access_iterator_tag)
- { return __last - __first >= 0; }
-
- /** Can't test for a valid range with input iterators, because
- * iteration may be destructive. So we just assume that the range
- * is valid.
- */
- template<typename _InputIterator>
- inline bool
- __valid_range_aux2(const _InputIterator&, const _InputIterator&,
- std::input_iterator_tag)
- { return true; }
-
- /** We say that integral types for a valid range, and defer to other
- * routines to realize what to do with integral types instead of
- * iterators.
- */
- template<typename _Integral>
- inline bool
- __valid_range_aux(const _Integral&, const _Integral&, std::__true_type)
- { return true; }
-
- /** We have iterators, so figure out what kind of iterators that are
- * to see if we can check the range ahead of time.
- */
- template<typename _InputIterator>
- inline bool
- __valid_range_aux(const _InputIterator& __first,
- const _InputIterator& __last, std::__false_type)
- { return __valid_range_aux2(__first, __last,
- std::__iterator_category(__first)); }
-
- /** Don't know what these iterators are, or if they are even
- * iterators (we may get an integral type for InputIterator), so
- * see if they are integral and pass them on to the next phase
- * otherwise.
- */
- template<typename _InputIterator>
- inline bool
- __valid_range(const _InputIterator& __first, const _InputIterator& __last)
- {
- typedef typename std::__is_integer<_InputIterator>::__type _Integral;
- return __valid_range_aux(__first, __last, _Integral());
- }
-
/* Checks that [first, last) is a valid range, and then returns
* __first. This routine is useful when we can't use a separate
* assertion statement because, e.g., we are in a constructor.
@@ -500,29 +444,6 @@ namespace __gnu_debug
return __first == __last;
}
- // Helper struct to detect random access safe iterators.
- template<typename _Iterator>
- struct __is_safe_random_iterator
- {
- enum { __value = 0 };
- typedef std::__false_type __type;
- };
-
- template<typename _Iterator>
- struct _Siter_base
- : std::_Iter_base<_Iterator, __is_safe_random_iterator<_Iterator>::__value>
- { };
-
- /** Helper function to extract base iterator of random access safe iterator
- in order to reduce performance impact of debug mode. Limited to random
- access iterator because it is the only category for which it is possible
- to check for correct iterators order in the __valid_range function
- thanks to the < operator.
- */
- template<typename _Iterator>
- inline typename _Siter_base<_Iterator>::iterator_type
- __base(_Iterator __it)
- { return _Siter_base<_Iterator>::_S_base(__it); }
} // namespace __gnu_debug
#endif