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>
61 template<
typename _Iterator,
62 typename =
typename std::__is_integer<_Iterator>::__type>
63 struct _Distance_traits
69 template<
typename _DiffType,
typename = _DiffType>
71 {
typedef _DiffType __type; };
73 template<
typename _DiffType>
74 struct _DiffTraits<_DiffType, void>
75 {
typedef std::ptrdiff_t __type; };
77 typedef typename _DiffTraits<_ItDiffType>::__type _DiffType;
80 typedef std::pair<_DiffType, _Distance_precision> __type;
83 template<
typename _Integral>
84 struct _Distance_traits<_Integral, std::__true_type>
85 {
typedef std::pair<std::ptrdiff_t, _Distance_precision> __type; };
90 template<
typename _Iterator>
92 inline typename _Distance_traits<_Iterator>::__type
97 template<
typename _Iterator>
99 inline typename _Distance_traits<_Iterator>::__type
109 template<
typename _Iterator>
111 inline typename _Distance_traits<_Iterator>::__type
120 __check_singular_aux(
const void*) {
return false; }
128 template<
typename _Iterator>
131 __check_singular(_Iterator
const& __x)
133 return ! std::__is_constant_evaluated()
138 template<
typename _Tp>
141 __check_singular(_Tp*
const& __ptr)
142 {
return __ptr == 0; }
148 template<
typename _Integral>
154 template<
typename _Integral>
158 typename _Distance_traits<_Integral>::__type& __dist,
165 template<
typename _InputIterator>
169 std::input_iterator_tag)
173 if (std::__is_constant_evaluated())
176 return __first == __last
177 || (!__gnu_debug::__check_singular(__first)
178 && !__gnu_debug::__check_singular(__last));
181 template<
typename _InputIterator>
185 std::random_access_iterator_tag)
188 std::input_iterator_tag())
189 && __first <= __last;
195 template<
typename _InputIterator>
205 template<
typename _InputIterator>
209 typename _Distance_traits<_InputIterator>::__type& __dist,
217 switch (__dist.second)
222 if (__dist.first == 0)
226 case __dp_sign_max_size:
228 return __dist.first >= 0;
240 template<
typename _InputIterator>
244 typename _Distance_traits<_InputIterator>::__type& __dist)
246 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
251 template<
typename _Iterator,
typename _Sequence,
typename _Category>
253 __valid_range(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
254 const _Safe_iterator<_Iterator, _Sequence, _Category>&,
255 typename _Distance_traits<_Iterator>::__type&);
257#if __cplusplus >= 201103L
258 template<
typename _Iterator,
typename _Sequence>
260 __valid_range(
const _Safe_local_iterator<_Iterator, _Sequence>&,
261 const _Safe_local_iterator<_Iterator, _Sequence>&,
262 typename _Distance_traits<_Iterator>::__type&);
265 template<
typename _InputIterator>
270 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
274 template<
typename _Iterator,
typename _Sequence,
typename _Category>
279#if __cplusplus >= 201103L
280 template<
typename _Iterator,
typename _Sequence>
287 template<
typename _InputIterator,
typename _Size>
290 __can_advance(_InputIterator, _Size)
293 template<
typename _Iterator,
typename _Sequence,
typename _Category,
299 template<
typename _InputIterator,
typename _Diff>
305 template<
typename _Iterator,
typename _Sequence,
typename _Category,
317 template<
typename _Iterator>
323#if __cplusplus < 201103L
324 template<
typename _Iterator>
326 {
typedef _Iterator _Type; };
330 template<
typename _Iterator>
333 __unsafe(_Iterator __it)
pair(_T1, _T2) -> pair< _T1, _T2 >
Two pairs are equal iff their members are equal.
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
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)
Random-access iterators support a superset of bidirectional iterator operations.
Traits class for iterators.
Basic functionality for a safe iterator.