* xcoff.c (struct xcoff_line, struct xcoff_line_vector): Remove.
[official-gcc.git] / libstdc++-v3 / include / debug / stl_iterator.h
blobf20b000e0e589e51a777a0f4e669eb3eaee38ca2
1 // Debugging support implementation -*- C++ -*-
3 // Copyright (C) 2015-2018 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 /** @file debug/stl_iterator.h
26 * This file is a GNU debug extension to the Standard C++ Library.
29 #ifndef _GLIBCXX_DEBUG_STL_ITERATOR_H
30 #define _GLIBCXX_DEBUG_STL_ITERATOR_H 1
32 #include <debug/helper_functions.h>
34 namespace __gnu_debug
36 // Help Debug mode to see through reverse_iterator.
37 template<typename _Iterator>
38 inline bool
39 __valid_range(const std::reverse_iterator<_Iterator>& __first,
40 const std::reverse_iterator<_Iterator>& __last,
41 typename _Distance_traits<_Iterator>::__type& __dist)
42 { return __valid_range(__last.base(), __first.base(), __dist); }
44 template<typename _Iterator>
45 inline typename _Distance_traits<_Iterator>::__type
46 __get_distance(const std::reverse_iterator<_Iterator>& __first,
47 const std::reverse_iterator<_Iterator>& __last)
48 { return __get_distance(__last.base(), __first.base()); }
50 template<typename _Iterator, typename _Size>
51 inline bool
52 __can_advance(const std::reverse_iterator<_Iterator>& __it, _Size __n)
53 { return __can_advance(__it.base(), -__n); }
55 #if __cplusplus < 201103L
56 template<typename _Iterator>
57 struct __is_safe_random_iterator<std::reverse_iterator<_Iterator> >
58 : __is_safe_random_iterator<_Iterator>
59 { };
61 template<typename _Iterator>
62 struct _Unsafe_type<std::reverse_iterator<_Iterator> >
64 typedef typename _Unsafe_type<_Iterator>::_Type _UnsafeType;
65 typedef std::reverse_iterator<_UnsafeType> _Type;
68 template<typename _Iterator>
69 inline std::reverse_iterator<typename _Unsafe_type<_Iterator>::_Type>
70 __unsafe(const std::reverse_iterator<_Iterator>& __it)
72 typedef typename _Unsafe_type<_Iterator>::_Type _UnsafeType;
73 return std::reverse_iterator<_UnsafeType>(__unsafe(__it.base()));
75 #else
76 template<typename _Iterator>
77 inline auto
78 __base(const std::reverse_iterator<_Iterator>& __it)
79 -> decltype(std::__make_reverse_iterator(__base(__it.base())))
80 { return std::__make_reverse_iterator(__base(__it.base())); }
82 template<typename _Iterator>
83 inline auto
84 __unsafe(const std::reverse_iterator<_Iterator>& __it)
85 -> decltype(std::__make_reverse_iterator(__unsafe(__it.base())))
86 { return std::__make_reverse_iterator(__unsafe(__it.base())); }
87 #endif
89 #if __cplusplus >= 201103L
90 // Help Debug mode to see through move_iterator.
91 template<typename _Iterator>
92 inline bool
93 __valid_range(const std::move_iterator<_Iterator>& __first,
94 const std::move_iterator<_Iterator>& __last,
95 typename _Distance_traits<_Iterator>::__type& __dist)
96 { return __valid_range(__first.base(), __last.base(), __dist); }
98 template<typename _Iterator>
99 inline typename _Distance_traits<_Iterator>::__type
100 __get_distance(const std::move_iterator<_Iterator>& __first,
101 const std::move_iterator<_Iterator>& __last)
102 { return __get_distance(__first.base(), __last.base()); }
104 template<typename _Iterator, typename _Size>
105 inline bool
106 __can_advance(const std::move_iterator<_Iterator>& __it, _Size __n)
107 { return __can_advance(__it.base(), __n); }
109 template<typename _Iterator>
110 inline auto
111 __unsafe(const std::move_iterator<_Iterator>& __it)
112 -> decltype(std::make_move_iterator(__unsafe(__it.base())))
113 { return std::make_move_iterator(__unsafe(__it.base())); }
115 template<typename _Iterator>
116 inline auto
117 __base(const std::move_iterator<_Iterator>& __it)
118 -> decltype(std::make_move_iterator(__base(__it.base())))
119 { return std::make_move_iterator(__base(__it.base())); }
120 #endif
123 namespace std
125 _GLIBCXX_BEGIN_NAMESPACE_VERSION
127 template<typename _Iterator, typename _Container, typename _Sequence>
128 _Iterator
129 __niter_base(const __gnu_debug::_Safe_iterator<
130 __gnu_cxx::__normal_iterator<_Iterator, _Container>,
131 _Sequence>&);
133 _GLIBCXX_END_NAMESPACE_VERSION
136 #endif