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>
125 __check_singular(_Iterator
const& __x)
128#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
129 __builtin_is_constant_evaluated() ? false :
135 template<
typename _Tp>
138 __check_singular(_Tp*
const& __ptr)
141#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
142 __builtin_is_constant_evaluated() ? false :
151 template<
typename _Integral>
157 template<
typename _Integral>
161 typename _Distance_traits<_Integral>::__type& __dist,
164 __dist = std::make_pair(0, __dp_none);
168 template<
typename _InputIterator>
174 return __first == __last
175 || (!__check_singular(__first) && !__check_singular(__last));
178 template<
typename _InputIterator>
186 && __first <= __last;
192 template<
typename _InputIterator>
202 template<
typename _InputIterator>
206 typename _Distance_traits<_InputIterator>::__type& __dist,
213 switch (__dist.second)
218 if (__dist.first == 0)
222 case __dp_sign_max_size:
224 return __dist.first >= 0;
236 template<
typename _InputIterator>
242 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
246 template<
typename _Iterator,
typename _Sequence,
typename _Category>
248 __valid_range(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
249 const _Safe_iterator<_Iterator, _Sequence, _Category>&,
250 typename _Distance_traits<_Iterator>::__type&);
252#if __cplusplus >= 201103L
253 template<
typename _Iterator,
typename _Sequence>
255 __valid_range(
const _Safe_local_iterator<_Iterator, _Sequence>&,
256 const _Safe_local_iterator<_Iterator, _Sequence>&,
257 typename _Distance_traits<_Iterator>::__type&);
260 template<
typename _InputIterator>
265 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
269 template<
typename _Iterator,
typename _Sequence,
typename _Category>
271 __valid_range(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
272 const _Safe_iterator<_Iterator, _Sequence, _Category>&);
274#if __cplusplus >= 201103L
275 template<
typename _Iterator,
typename _Sequence>
277 __valid_range(
const _Safe_local_iterator<_Iterator, _Sequence>&,
278 const _Safe_local_iterator<_Iterator, _Sequence>&);
282 template<
typename _InputIterator,
typename _Size>
285 __can_advance(_InputIterator, _Size)
288 template<
typename _Iterator,
typename _Sequence,
typename _Category,
291 __can_advance(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
294 template<
typename _InputIterator,
typename _Diff>
300 template<
typename _Iterator,
typename _Sequence,
typename _Category,
303 __can_advance(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
312 template<
typename _Iterator>
318#if __cplusplus < 201103L
319 template<
typename _Iterator>
321 {
typedef _Iterator _Type; };
325 template<
typename _Iterator>
327 __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 bool __valid_range_aux(_Integral, _Integral, std::__true_type)
constexpr _Distance_traits< _Iterator >::__type __get_distance(_Iterator __lhs, _Iterator __rhs, std::random_access_iterator_tag)
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.