29 #ifndef _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H 30 #define _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H 1 35 #if __cplusplus < 201103L 43 template<
typename _Iterator,
typename _Sequence,
typename _Category>
46 #if __cplusplus >= 201103L 47 template<
typename _Iterator,
typename _Sequence>
48 class _Safe_local_iterator;
63 #if __cplusplus >= 201103L 64 template<
typename _Iterator>
66 template<
typename _Iterator,
67 typename =
typename std::__is_integer<_Iterator>::__type>
69 struct _Distance_traits
75 template<
typename _DiffType,
typename = _DiffType>
77 {
typedef _DiffType __type; };
79 template<
typename _DiffType>
80 struct _DiffTraits<_DiffType, void>
81 {
typedef std::ptrdiff_t __type; };
83 typedef typename _DiffTraits<_ItDiffType>::__type _DiffType;
89 #if __cplusplus < 201103L 90 template<
typename _Integral>
91 struct _Distance_traits<_Integral, std::__true_type>
98 template<
typename _Iterator>
103 {
return std::make_pair(__rhs - __lhs, __dp_exact); }
105 template<
typename _Iterator>
112 return std::make_pair(0, __dp_exact);
114 return std::make_pair(1, __dp_equality);
117 template<
typename _Iterator>
128 __check_singular_aux(
const void*) {
return false; }
136 template<
typename _Iterator>
139 __check_singular(_Iterator
const& __x)
141 return ! std::__is_constant_evaluated()
146 template<
typename _Tp>
149 __check_singular(_Tp*
const& __ptr)
150 {
return __ptr == 0; }
152 #if __cplusplus < 201103L 154 template<
typename _Integral>
156 __valid_range_aux(_Integral, _Integral, std::__true_type)
159 template<
typename _Integral>
161 __valid_range_aux(_Integral, _Integral,
165 __dist = std::make_pair(0, __dp_none);
170 template<
typename _InputIterator>
173 __valid_range_aux(_InputIterator __first, _InputIterator __last,
178 if (std::__is_constant_evaluated())
181 return __first == __last
186 template<
typename _InputIterator>
189 __valid_range_aux(_InputIterator __first, _InputIterator __last,
192 return __gnu_debug::__valid_range_aux(__first, __last,
194 && __first <= __last;
197 #if __cplusplus >= 201103L 198 template<
typename _InputIterator>
200 __valid_range(_InputIterator __first, _InputIterator __last)
205 template<
typename _InputIterator>
207 __valid_range_aux(_InputIterator __first, _InputIterator __last,
211 return __gnu_debug::__valid_range_aux(__first, __last,
215 #if __cplusplus >= 201103L 216 template<
typename _InputIterator>
219 __valid_range(_InputIterator __first, _InputIterator __last,
222 template<
typename _InputIterator>
224 __valid_range_aux(_InputIterator __first, _InputIterator __last,
229 if (!__gnu_debug::__valid_range_aux(__first, __last,
239 if (__dist.
first == 0)
243 case __dp_sign_max_size:
245 return __dist.
first >= 0;
252 #if __cplusplus < 201103L 258 template<
typename _InputIterator>
260 __valid_range(_InputIterator __first, _InputIterator __last,
263 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
264 return __gnu_debug::__valid_range_aux(__first, __last, __dist,
269 template<
typename _Iterator,
typename _Sequence,
typename _Category>
270 _GLIBCXX20_CONSTEXPR
bool 275 #if __cplusplus >= 201103L 276 template<
typename _Iterator,
typename _Sequence>
283 #if __cplusplus < 201103L 284 template<
typename _InputIterator>
286 __valid_range(_InputIterator __first, _InputIterator __last)
288 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
289 return __gnu_debug::__valid_range_aux(__first, __last, _Integral());
293 template<
typename _Iterator,
typename _Sequence,
typename _Category>
294 _GLIBCXX20_CONSTEXPR
bool 298 #if __cplusplus >= 201103L 299 template<
typename _Iterator,
typename _Sequence>
306 template<
typename _InputIterator,
typename _Size>
309 __can_advance(_InputIterator, _Size)
312 template<
typename _Iterator,
typename _Sequence,
typename _Category,
314 _GLIBCXX20_CONSTEXPR
bool 318 template<
typename _InputIterator,
typename _Diff>
324 template<
typename _Iterator,
typename _Sequence,
typename _Category,
326 _GLIBCXX20_CONSTEXPR
bool 336 template<
typename _Iterator>
342 #if __cplusplus < 201103L 343 template<
typename _Iterator>
345 {
typedef _Iterator _Type; };
349 template<
typename _Iterator>
352 __unsafe(_Iterator __it)
constexpr _Distance_traits< _Iterator >::__type __get_distance(_Iterator __lhs, _Iterator __rhs, std::random_access_iterator_tag)
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
Basic functionality for a safe iterator.
GNU debug classes for public use.
constexpr bool __check_singular(_Tp *const &__ptr)
Struct holding two objects of arbitrary type.
Random-access iterators support a superset of bidirectional iterator operations.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
_T2 second
The second member.
_T1 first
The first member.
constexpr _Iterator __base(_Iterator __it)
bool __check_singular_aux(const _Safe_iterator_base *__x)
Traits class for iterators.