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)
127 return ! std::__is_constant_evaluated()
132 template<
typename _Tp>
135 __check_singular(_Tp*
const& __ptr)
136 {
return __ptr == 0; }
142 template<
typename _Integral>
148 template<
typename _Integral>
152 typename _Distance_traits<_Integral>::__type& __dist,
155 __dist = std::make_pair(0, __dp_none);
159 template<
typename _InputIterator>
165 return __first == __last
166 || (!__check_singular(__first) && !__check_singular(__last));
169 template<
typename _InputIterator>
177 && __first <= __last;
183 template<
typename _InputIterator>
193 template<
typename _InputIterator>
197 typename _Distance_traits<_InputIterator>::__type& __dist,
204 switch (__dist.second)
209 if (__dist.first == 0)
213 case __dp_sign_max_size:
215 return __dist.first >= 0;
227 template<
typename _InputIterator>
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 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
260 template<
typename _Iterator,
typename _Sequence,
typename _Category>
262 __valid_range(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
263 const _Safe_iterator<_Iterator, _Sequence, _Category>&);
265 #if __cplusplus >= 201103L
266 template<
typename _Iterator,
typename _Sequence>
268 __valid_range(
const _Safe_local_iterator<_Iterator, _Sequence>&,
269 const _Safe_local_iterator<_Iterator, _Sequence>&);
273 template<
typename _InputIterator,
typename _Size>
276 __can_advance(_InputIterator, _Size)
279 template<
typename _Iterator,
typename _Sequence,
typename _Category,
282 __can_advance(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
285 template<
typename _InputIterator,
typename _Diff>
291 template<
typename _Iterator,
typename _Sequence,
typename _Category,
294 __can_advance(
const _Safe_iterator<_Iterator, _Sequence, _Category>&,
303 template<
typename _Iterator>
309 #if __cplusplus < 201103L
310 template<
typename _Iterator>
312 {
typedef _Iterator _Type; };
316 template<
typename _Iterator>
318 __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.
Struct holding two objects of arbitrary type.
Random-access iterators support a superset of bidirectional iterator operations.