29 #ifndef _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H
30 #define _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H 1
41 template<
typename _Iterator,
typename _Sequence,
typename _Category>
44 #if __cplusplus >= 201103L
45 template<
typename _Iterator,
typename _Sequence>
46 class _Safe_local_iterator;
61 template<
typename _Iterator,
62 typename =
typename std::__is_integer<_Iterator>::__type>
63 struct _Distance_traits
69 template<
typename _DiffType,
70 typename =
typename std::__is_void<_DiffType>::__type>
72 {
typedef _DiffType __type; };
74 template<
typename _DiffType>
75 struct _DiffTraits<_DiffType,
std::__true_type>
76 {
typedef std::ptrdiff_t __type; };
78 typedef typename _DiffTraits<_ItDiffType>::__type _DiffType;
84 template<
typename _Integral>
85 struct _Distance_traits<_Integral,
std::__true_type>
91 template<
typename _Iterator>
93 inline typename _Distance_traits<_Iterator>::__type
96 {
return std::make_pair(__rhs - __lhs, __dp_exact); }
98 template<
typename _Iterator>
100 inline typename _Distance_traits<_Iterator>::__type
105 return std::make_pair(0, __dp_exact);
107 return std::make_pair(1, __dp_equality);
110 template<
typename _Iterator>
112 inline typename _Distance_traits<_Iterator>::__type
118 __check_singular_aux(
const void*) {
return false; }
122 template<
typename _Iterator>
124 __check_singular(_Iterator
const& __x)
128 template<
typename _Tp>
130 __check_singular(_Tp*
const& __ptr)
131 {
return __ptr == 0; }
137 template<
typename _Integral>
143 template<
typename _Integral>
147 typename _Distance_traits<_Integral>::__type& __dist,
150 __dist = std::make_pair(0, __dp_none);
154 template<
typename _InputIterator>
160 return __first == __last
161 || (!__check_singular(__first) && !__check_singular(__last));
164 template<
typename _InputIterator>
172 && __first <= __last;
178 template<
typename _InputIterator>
188 template<
typename _InputIterator>
192 typename _Distance_traits<_InputIterator>::__type& __dist,
199 switch (__dist.second)
204 if (__dist.first == 0)
208 case __dp_sign_max_size:
210 return __dist.first >= 0;
222 template<
typename _InputIterator>
228 #ifdef __cpp_lib_is_constant_evaluated
229 if (std::is_constant_evaluated())
233 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
237 template<
typename _Iterator,
typename _Sequence,
typename _Category>
239 __valid_range(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
240 const _Safe_iterator<_Iterator, _Sequence, _Category>&,
241 typename _Distance_traits<_Iterator>::__type&);
243 #if __cplusplus >= 201103L
244 template<
typename _Iterator,
typename _Sequence>
246 __valid_range(
const _Safe_local_iterator<_Iterator, _Sequence>&,
247 const _Safe_local_iterator<_Iterator, _Sequence>&,
248 typename _Distance_traits<_Iterator>::__type&);
251 template<
typename _InputIterator>
256 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
257 if (__builtin_is_constant_evaluated())
261 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
265 template<
typename _Iterator,
typename _Sequence,
typename _Category>
267 __valid_range(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
268 const _Safe_iterator<_Iterator, _Sequence, _Category>&);
270 #if __cplusplus >= 201103L
271 template<
typename _Iterator,
typename _Sequence>
273 __valid_range(
const _Safe_local_iterator<_Iterator, _Sequence>&,
274 const _Safe_local_iterator<_Iterator, _Sequence>&);
278 template<
typename _InputIterator,
typename _Size>
281 __can_advance(_InputIterator, _Size)
284 template<
typename _Iterator,
typename _Sequence,
typename _Category,
287 __can_advance(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
290 template<
typename _InputIterator,
typename _Diff>
296 template<
typename _Iterator,
typename _Sequence,
typename _Category,
299 __can_advance(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
308 template<
typename _Iterator>
314 #if __cplusplus < 201103L
315 template<
typename _Iterator>
317 {
typedef _Iterator _Type; };
321 template<
typename _Iterator>
323 __unsafe(_Iterator __it)
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
ISO C++ entities toplevel namespace is std.
GNU debug classes for public use.
constexpr _Distance_traits< _Iterator >::__type __get_distance(_Iterator __lhs, _Iterator __rhs, std::random_access_iterator_tag)
constexpr bool __valid_range_aux(_Integral, _Integral, std::__true_type)
constexpr bool __valid_range(_InputIterator __first, _InputIterator __last, typename _Distance_traits< _InputIterator >::__type &__dist)
constexpr _Iterator __base(_Iterator __it)
Traits class for iterators.
Random-access iterators support a superset of bidirectional iterator operations.
Struct holding two objects of arbitrary type.