xref: /freebsd/contrib/llvm-project/libcxx/include/__cxx03/iterator (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric// -*- C++ -*-
2*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
3*700637cbSDimitry Andric//
4*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*700637cbSDimitry Andric//
8*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
9*700637cbSDimitry Andric
10*700637cbSDimitry Andric#ifndef _LIBCPP___CXX03_ITERATOR
11*700637cbSDimitry Andric#define _LIBCPP___CXX03_ITERATOR
12*700637cbSDimitry Andric
13*700637cbSDimitry Andric/*
14*700637cbSDimitry Andric    iterator synopsis
15*700637cbSDimitry Andric
16*700637cbSDimitry Andric#include <__cxx03/concepts>
17*700637cbSDimitry Andric
18*700637cbSDimitry Andricnamespace std
19*700637cbSDimitry Andric{
20*700637cbSDimitry Andrictemplate<class> struct incrementable_traits;       // since C++20
21*700637cbSDimitry Andrictemplate<class T>
22*700637cbSDimitry Andric  using iter_difference_t = see below;             // since C++20
23*700637cbSDimitry Andric
24*700637cbSDimitry Andrictemplate<class> struct indirectly_readable_traits; // since C++20
25*700637cbSDimitry Andrictemplate<class T>
26*700637cbSDimitry Andric  using iter_value_t = see below;                  // since C++20
27*700637cbSDimitry Andric
28*700637cbSDimitry Andrictemplate<class Iterator>
29*700637cbSDimitry Andricstruct iterator_traits;
30*700637cbSDimitry Andric
31*700637cbSDimitry Andrictemplate<class T>
32*700637cbSDimitry Andric  requires is_object_v<T>                    // since C++20
33*700637cbSDimitry Andricstruct iterator_traits<T*>;
34*700637cbSDimitry Andric
35*700637cbSDimitry Andrictemplate<dereferenceable T>
36*700637cbSDimitry Andric  using iter_reference_t = decltype(*declval<T&>());
37*700637cbSDimitry Andric
38*700637cbSDimitry Andricnamespace ranges::inline unspecified {
39*700637cbSDimitry Andric    inline constexpr unspecified iter_move = unspecified; // since C++20, nodiscard as an extension
40*700637cbSDimitry Andric}}
41*700637cbSDimitry Andric
42*700637cbSDimitry Andrictemplate<dereferenceable T>
43*700637cbSDimitry Andric  requires ...
44*700637cbSDimitry Andricusing iter_rvalue_reference_t = decltype(ranges::iter_move(declval<T&>())); // since C++20
45*700637cbSDimitry Andric
46*700637cbSDimitry Andric// [iterator.concepts], iterator concepts
47*700637cbSDimitry Andric// [iterator.concept.readable], concept indirectly_readable
48*700637cbSDimitry Andrictemplate<class In>
49*700637cbSDimitry Andric  concept indirectly_readable = see below;                      // since C++20
50*700637cbSDimitry Andric
51*700637cbSDimitry Andrictemplate<indirectly_readable T>
52*700637cbSDimitry Andric  using iter_common_reference_t =
53*700637cbSDimitry Andric    common_reference_t<iter_reference_t<T>, iter_value_t<T>&>;  // since C++20
54*700637cbSDimitry Andric
55*700637cbSDimitry Andric// [iterator.concept.writable], concept indirectly_writable
56*700637cbSDimitry Andrictemplate<class Out, class T>
57*700637cbSDimitry Andric  concept indirectly_writable = see below;                // since C++20
58*700637cbSDimitry Andric
59*700637cbSDimitry Andric// [iterator.concept.winc], concept weakly_incrementable
60*700637cbSDimitry Andrictemplate<class I>
61*700637cbSDimitry Andric  concept weakly_incrementable = see below;                // since C++20
62*700637cbSDimitry Andric
63*700637cbSDimitry Andric// [iterator.concept.inc], concept incrementable
64*700637cbSDimitry Andrictemplate<class I>
65*700637cbSDimitry Andric  concept incrementable = see below;                       // since C++20
66*700637cbSDimitry Andric
67*700637cbSDimitry Andric// [iterator.concept.iterator], concept input_or_output_iterator
68*700637cbSDimitry Andric  template<class I>
69*700637cbSDimitry Andric    concept input_or_output_iterator = see below;          // since C++20
70*700637cbSDimitry Andric
71*700637cbSDimitry Andric// [iterator.concept.sentinel], concept sentinel_for
72*700637cbSDimitry Andrictemplate<class S, class I>
73*700637cbSDimitry Andric  concept sentinel_for = see below;                        // since C++20
74*700637cbSDimitry Andric
75*700637cbSDimitry Andric// [iterator.concept.sizedsentinel], concept sized_sentinel_for
76*700637cbSDimitry Andrictemplate<class S, class I>
77*700637cbSDimitry Andric  inline constexpr bool disable_sized_sentinel_for = false;
78*700637cbSDimitry Andric
79*700637cbSDimitry Andrictemplate<class S, class I>
80*700637cbSDimitry Andric  concept sized_sentinel_for = see below;
81*700637cbSDimitry Andric
82*700637cbSDimitry Andric// [iterator.concept.input], concept input_iterator
83*700637cbSDimitry Andrictemplate<class I>
84*700637cbSDimitry Andric  concept input_iterator = see below;                      // since C++20
85*700637cbSDimitry Andric
86*700637cbSDimitry Andric// [iterator.concept.output], concept output_iterator
87*700637cbSDimitry Andrictemplate<class I, class T>
88*700637cbSDimitry Andric  concept output_iterator = see below;                     // since C++20
89*700637cbSDimitry Andric
90*700637cbSDimitry Andric// [iterator.concept.forward], concept forward_iterator
91*700637cbSDimitry Andrictemplate<class I>
92*700637cbSDimitry Andric  concept forward_iterator = see below;                    // since C++20
93*700637cbSDimitry Andric
94*700637cbSDimitry Andric// [iterator.concept.bidir], concept bidirectional_iterator
95*700637cbSDimitry Andrictemplate<class I>
96*700637cbSDimitry Andric  concept bidirectional_iterator = see below;              // since C++20
97*700637cbSDimitry Andric
98*700637cbSDimitry Andric// [iterator.concept.random.access], concept random_access_iterator
99*700637cbSDimitry Andrictemplate<class I>
100*700637cbSDimitry Andric  concept random_access_iterator = see below;              // since C++20
101*700637cbSDimitry Andric
102*700637cbSDimitry Andric// [indirectcallable]
103*700637cbSDimitry Andric// [indirectcallable.indirectinvocable]
104*700637cbSDimitry Andrictemplate<class F, class I>
105*700637cbSDimitry Andric  concept indirectly_unary_invocable = see below;          // since C++20
106*700637cbSDimitry Andric
107*700637cbSDimitry Andrictemplate<class F, class I>
108*700637cbSDimitry Andric  concept indirectly_regular_unary_invocable = see below;  // since C++20
109*700637cbSDimitry Andric
110*700637cbSDimitry Andrictemplate<class F, class I>
111*700637cbSDimitry Andric  concept indirect_unary_predicate = see below;            // since C++20
112*700637cbSDimitry Andric
113*700637cbSDimitry Andrictemplate<class F, class I1, class I2>
114*700637cbSDimitry Andric  concept indirect_binary_predicate = see below;           // since C++20
115*700637cbSDimitry Andric
116*700637cbSDimitry Andrictemplate<class F, class I1, class I2 = I1>
117*700637cbSDimitry Andric  concept indirect_equivalence_relation = see below;       // since C++20
118*700637cbSDimitry Andric
119*700637cbSDimitry Andrictemplate<class F, class I1, class I2 = I1>
120*700637cbSDimitry Andric  concept indirect_strict_weak_order = see below;          // since C++20
121*700637cbSDimitry Andric
122*700637cbSDimitry Andrictemplate<class F, class... Is>
123*700637cbSDimitry Andric  using indirect_result_t = see below;                     // since C++20
124*700637cbSDimitry Andric
125*700637cbSDimitry Andric// [projected], projected
126*700637cbSDimitry Andrictemplate<indirectly_readable I, indirectly_regular_unary_invocable<I> Proj>
127*700637cbSDimitry Andric  struct projected;                                        // since C++20
128*700637cbSDimitry Andric
129*700637cbSDimitry Andrictemplate<weakly_incrementable I, indirectly_regular_unary_invocable<I> Proj>
130*700637cbSDimitry Andric  struct incrementable_traits<projected<I, Proj>>;         // since C++20
131*700637cbSDimitry Andric
132*700637cbSDimitry Andric// [alg.req.ind.move], concept indirectly_movable
133*700637cbSDimitry Andrictemplate<class In, class Out>
134*700637cbSDimitry Andric  concept indirectly_movable = see below;                  // since C++20
135*700637cbSDimitry Andric
136*700637cbSDimitry Andrictemplate<class In, class Out>
137*700637cbSDimitry Andric  concept indirectly_movable_storable = see below;         // since C++20
138*700637cbSDimitry Andric
139*700637cbSDimitry Andric// [alg.req.ind.copy], concept indirectly_copyable
140*700637cbSDimitry Andrictemplate<class In, class Out>
141*700637cbSDimitry Andric  concept indirectly_copyable = see below;                 // since C++20
142*700637cbSDimitry Andric
143*700637cbSDimitry Andrictemplate<class In, class Out>
144*700637cbSDimitry Andric  concept indirectly_copyable_storable = see below;        // since C++20
145*700637cbSDimitry Andric
146*700637cbSDimitry Andric// [alg.req.ind.swap], concept indirectly_swappable
147*700637cbSDimitry Andrictemplate<class I1, class I2 = I1>
148*700637cbSDimitry Andric  concept indirectly_swappable = see below;                // since C++20
149*700637cbSDimitry Andric
150*700637cbSDimitry Andrictemplate<class I1, class I2, class R, class P1 = identity,
151*700637cbSDimitry Andric         class P2 = identity>
152*700637cbSDimitry Andric  concept indirectly_comparable =
153*700637cbSDimitry Andric    indirect_binary_predicate<R, projected<I1, P1>, projected<I2, P2>>; // since C++20
154*700637cbSDimitry Andric
155*700637cbSDimitry Andric// [alg.req.permutable], concept permutable
156*700637cbSDimitry Andrictemplate<class I>
157*700637cbSDimitry Andric  concept permutable = see below;                          // since C++20
158*700637cbSDimitry Andric
159*700637cbSDimitry Andric // [alg.req.mergeable], concept mergeable
160*700637cbSDimitry Andrictemplate<class I1, class I2, class Out,
161*700637cbSDimitry Andric    class R = ranges::less, class P1 = identity, class P2 = identity>
162*700637cbSDimitry Andric  concept mergeable = see below;                           // since C++20
163*700637cbSDimitry Andric
164*700637cbSDimitry Andric// [alg.req.sortable], concept sortable
165*700637cbSDimitry Andrictemplate<class I, class R = ranges::less, class P = identity>
166*700637cbSDimitry Andric  concept sortable = see below;                            // since C++20
167*700637cbSDimitry Andric
168*700637cbSDimitry Andrictemplate<input_or_output_iterator I, sentinel_for<I> S>
169*700637cbSDimitry Andric  requires (!same_as<I, S> && copyable<I>)
170*700637cbSDimitry Andricclass common_iterator;                                     // since C++20
171*700637cbSDimitry Andric
172*700637cbSDimitry Andrictemplate<class Category, class T, class Distance = ptrdiff_t,
173*700637cbSDimitry Andric         class Pointer = T*, class Reference = T&>
174*700637cbSDimitry Andricstruct iterator                                            // deprecated in C++17
175*700637cbSDimitry Andric{
176*700637cbSDimitry Andric    typedef T         value_type;
177*700637cbSDimitry Andric    typedef Distance  difference_type;
178*700637cbSDimitry Andric    typedef Pointer   pointer;
179*700637cbSDimitry Andric    typedef Reference reference;
180*700637cbSDimitry Andric    typedef Category  iterator_category;
181*700637cbSDimitry Andric};
182*700637cbSDimitry Andric
183*700637cbSDimitry Andricstruct input_iterator_tag  {};
184*700637cbSDimitry Andricstruct output_iterator_tag {};
185*700637cbSDimitry Andricstruct forward_iterator_tag       : public input_iterator_tag         {};
186*700637cbSDimitry Andricstruct bidirectional_iterator_tag : public forward_iterator_tag       {};
187*700637cbSDimitry Andricstruct random_access_iterator_tag : public bidirectional_iterator_tag {};
188*700637cbSDimitry Andricstruct contiguous_iterator_tag    : public random_access_iterator_tag {};
189*700637cbSDimitry Andric
190*700637cbSDimitry Andric// 27.4.3, iterator operations
191*700637cbSDimitry Andrictemplate <class InputIterator, class Distance>  // constexpr in C++17
192*700637cbSDimitry Andric  constexpr void advance(InputIterator& i, Distance n);
193*700637cbSDimitry Andric
194*700637cbSDimitry Andrictemplate <class InputIterator>  // constexpr in C++17
195*700637cbSDimitry Andric  constexpr typename iterator_traits<InputIterator>::difference_type
196*700637cbSDimitry Andric    distance(InputIterator first, InputIterator last);
197*700637cbSDimitry Andric
198*700637cbSDimitry Andrictemplate <class InputIterator>  // constexpr in C++17
199*700637cbSDimitry Andric  constexpr InputIterator next(InputIterator x,
200*700637cbSDimitry Andrictypename iterator_traits<InputIterator>::difference_type n = 1);
201*700637cbSDimitry Andric
202*700637cbSDimitry Andrictemplate <class BidirectionalIterator>  // constexpr in C++17
203*700637cbSDimitry Andric  constexpr BidirectionalIterator prev(BidirectionalIterator x,
204*700637cbSDimitry Andric    typename iterator_traits<BidirectionalIterator>::difference_type n = 1);
205*700637cbSDimitry Andric
206*700637cbSDimitry Andric// [range.iter.ops], range iterator operations
207*700637cbSDimitry Andricnamespace ranges {
208*700637cbSDimitry Andric  // [range.iter.op.advance], ranges::advance
209*700637cbSDimitry Andric  template<input_or_output_iterator I>
210*700637cbSDimitry Andric    constexpr void advance(I& i, iter_difference_t<I> n);                          // since C++20
211*700637cbSDimitry Andric  template<input_or_output_iterator I, sentinel_for<I> S>
212*700637cbSDimitry Andric    constexpr void advance(I& i, S bound);                                         // since C++20
213*700637cbSDimitry Andric  template<input_or_output_iterator I, sentinel_for<I> S>
214*700637cbSDimitry Andric    constexpr iter_difference_t<I> advance(I& i, iter_difference_t<I> n, S bound); // since C++20
215*700637cbSDimitry Andric}
216*700637cbSDimitry Andric
217*700637cbSDimitry Andrictemplate <class Iterator>
218*700637cbSDimitry Andricclass reverse_iterator
219*700637cbSDimitry Andric    : public iterator<typename iterator_traits<Iterator>::iterator_category, // until C++17
220*700637cbSDimitry Andric                      typename iterator_traits<Iterator>::value_type,
221*700637cbSDimitry Andric                      typename iterator_traits<Iterator>::difference_type,
222*700637cbSDimitry Andric                      typename iterator_traits<Iterator>::pointer,
223*700637cbSDimitry Andric                      typename iterator_traits<Iterator>::reference>
224*700637cbSDimitry Andric{
225*700637cbSDimitry Andricprotected:
226*700637cbSDimitry Andric    Iterator current;
227*700637cbSDimitry Andricpublic:
228*700637cbSDimitry Andric    using iterator_type     = Iterator;
229*700637cbSDimitry Andric    using iterator_concept  = see below; // since C++20
230*700637cbSDimitry Andric    using iterator_category = typename iterator_traits<Iterator>::iterator_category; // since C++17, until C++20
231*700637cbSDimitry Andric    using iterator_category = see below; // since C++20
232*700637cbSDimitry Andric    using value_type        = typename iterator_traits<Iterator>::value_type; // since C++17, until C++20
233*700637cbSDimitry Andric    using value_type        = iter_value_t<Iterator>; // since C++20
234*700637cbSDimitry Andric    using difference_type   = typename iterator_traits<Iterator>::difference_type; // until C++20
235*700637cbSDimitry Andric    using difference_type   = iter_difference_t<Iterator>; // since C++20
236*700637cbSDimitry Andric    using pointer           = typename iterator_traits<Iterator>::pointer;
237*700637cbSDimitry Andric    using reference         = typename iterator_traits<Iterator>::reference; // until C++20
238*700637cbSDimitry Andric    using reference         = iter_reference_t<Iterator>; // since C++20
239*700637cbSDimitry Andric
240*700637cbSDimitry Andric    constexpr reverse_iterator();
241*700637cbSDimitry Andric    constexpr explicit reverse_iterator(Iterator x);
242*700637cbSDimitry Andric    template <class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
243*700637cbSDimitry Andric    template <class U> constexpr reverse_iterator& operator=(const reverse_iterator<U>& u);
244*700637cbSDimitry Andric    constexpr Iterator base() const;
245*700637cbSDimitry Andric    constexpr reference operator*() const;
246*700637cbSDimitry Andric    constexpr pointer   operator->() const; // until C++20
247*700637cbSDimitry Andric    constexpr pointer   operator->() const requires see below; // since C++20
248*700637cbSDimitry Andric    constexpr reverse_iterator& operator++();
249*700637cbSDimitry Andric    constexpr reverse_iterator  operator++(int);
250*700637cbSDimitry Andric    constexpr reverse_iterator& operator--();
251*700637cbSDimitry Andric    constexpr reverse_iterator  operator--(int);
252*700637cbSDimitry Andric    constexpr reverse_iterator  operator+ (difference_type n) const;
253*700637cbSDimitry Andric    constexpr reverse_iterator& operator+=(difference_type n);
254*700637cbSDimitry Andric    constexpr reverse_iterator  operator- (difference_type n) const;
255*700637cbSDimitry Andric    constexpr reverse_iterator& operator-=(difference_type n);
256*700637cbSDimitry Andric    constexpr unspecified       operator[](difference_type n) const;
257*700637cbSDimitry Andric
258*700637cbSDimitry Andric    friend constexpr iter_rvalue_reference_t<Iterator>
259*700637cbSDimitry Andric      iter_move(const reverse_iterator& i) noexcept(see below);
260*700637cbSDimitry Andric    template<indirectly_swappable<Iterator> Iterator2>
261*700637cbSDimitry Andric      friend constexpr void
262*700637cbSDimitry Andric        iter_swap(const reverse_iterator& x,
263*700637cbSDimitry Andric                  const reverse_iterator<Iterator2>& y) noexcept(see below);
264*700637cbSDimitry Andric};
265*700637cbSDimitry Andric
266*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
267*700637cbSDimitry Andricconstexpr bool                          // constexpr in C++17
268*700637cbSDimitry Andricoperator==(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
269*700637cbSDimitry Andric
270*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
271*700637cbSDimitry Andricconstexpr bool                          // constexpr in C++17
272*700637cbSDimitry Andricoperator!=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
273*700637cbSDimitry Andric
274*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
275*700637cbSDimitry Andricconstexpr bool                          // constexpr in C++17
276*700637cbSDimitry Andricoperator<(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
277*700637cbSDimitry Andric
278*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
279*700637cbSDimitry Andricconstexpr bool                          // constexpr in C++17
280*700637cbSDimitry Andricoperator>(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
281*700637cbSDimitry Andric
282*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
283*700637cbSDimitry Andricconstexpr bool                          // constexpr in C++17
284*700637cbSDimitry Andricoperator<=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
285*700637cbSDimitry Andric
286*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
287*700637cbSDimitry Andricconstexpr bool                          // constexpr in C++17
288*700637cbSDimitry Andricoperator>=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
289*700637cbSDimitry Andric
290*700637cbSDimitry Andrictemplate<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
291*700637cbSDimitry Andric  constexpr compare_three_way_result_t<Iterator1, Iterator2>
292*700637cbSDimitry Andric    operator<=>(const reverse_iterator<Iterator1>& x,
293*700637cbSDimitry Andric                const reverse_iterator<Iterator2>& y);
294*700637cbSDimitry Andric
295*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
296*700637cbSDimitry Andricconstexpr auto
297*700637cbSDimitry Andricoperator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y)
298*700637cbSDimitry Andric-> decltype(__y.base() - __x.base());   // constexpr in C++17
299*700637cbSDimitry Andric
300*700637cbSDimitry Andrictemplate <class Iterator>
301*700637cbSDimitry Andricconstexpr reverse_iterator<Iterator>
302*700637cbSDimitry Andricoperator+(typename reverse_iterator<Iterator>::difference_type n,
303*700637cbSDimitry Andric          const reverse_iterator<Iterator>& x);   // constexpr in C++17
304*700637cbSDimitry Andric
305*700637cbSDimitry Andrictemplate <class Iterator>
306*700637cbSDimitry Andricconstexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14, constexpr in C++17
307*700637cbSDimitry Andric
308*700637cbSDimitry Andrictemplate<class Iterator1, class Iterator2>
309*700637cbSDimitry Andric    requires (!sized_sentinel_for<Iterator1, Iterator2>)
310*700637cbSDimitry Andric  inline constexpr bool disable_sized_sentinel_for<reverse_iterator<Iterator1>,
311*700637cbSDimitry Andric                                                   reverse_iterator<Iterator2>> = true;
312*700637cbSDimitry Andric
313*700637cbSDimitry Andrictemplate <class Container>
314*700637cbSDimitry Andricclass back_insert_iterator
315*700637cbSDimitry Andric    : public iterator<output_iterator_tag, void, void, void, void> // until C++17
316*700637cbSDimitry Andric{
317*700637cbSDimitry Andricprotected:
318*700637cbSDimitry Andric    Container* container;
319*700637cbSDimitry Andricpublic:
320*700637cbSDimitry Andric    typedef Container                   container_type;
321*700637cbSDimitry Andric    typedef void                        value_type;
322*700637cbSDimitry Andric    typedef void                        difference_type; // until C++20
323*700637cbSDimitry Andric    typedef ptrdiff_t                   difference_type; // since C++20
324*700637cbSDimitry Andric    typedef void                        reference;
325*700637cbSDimitry Andric    typedef void                        pointer;
326*700637cbSDimitry Andric
327*700637cbSDimitry Andric    explicit back_insert_iterator(Container& x);  // constexpr in C++20
328*700637cbSDimitry Andric    back_insert_iterator& operator=(const typename Container::value_type& value);  // constexpr in C++20
329*700637cbSDimitry Andric    back_insert_iterator& operator*();  // constexpr in C++20
330*700637cbSDimitry Andric    back_insert_iterator& operator++();  // constexpr in C++20
331*700637cbSDimitry Andric    back_insert_iterator  operator++(int);  // constexpr in C++20
332*700637cbSDimitry Andric};
333*700637cbSDimitry Andric
334*700637cbSDimitry Andrictemplate <class Container> back_insert_iterator<Container> back_inserter(Container& x);  // constexpr in C++20
335*700637cbSDimitry Andric
336*700637cbSDimitry Andrictemplate <class Container>
337*700637cbSDimitry Andricclass front_insert_iterator
338*700637cbSDimitry Andric    : public iterator<output_iterator_tag, void, void, void, void> // until C++17
339*700637cbSDimitry Andric{
340*700637cbSDimitry Andricprotected:
341*700637cbSDimitry Andric    Container* container;
342*700637cbSDimitry Andricpublic:
343*700637cbSDimitry Andric    typedef Container                    container_type;
344*700637cbSDimitry Andric    typedef void                         value_type;
345*700637cbSDimitry Andric    typedef void                         difference_type; // until C++20
346*700637cbSDimitry Andric    typedef ptrdiff_t                    difference_type; // since C++20
347*700637cbSDimitry Andric    typedef void                         reference;
348*700637cbSDimitry Andric    typedef void                         pointer;
349*700637cbSDimitry Andric
350*700637cbSDimitry Andric    explicit front_insert_iterator(Container& x);  // constexpr in C++20
351*700637cbSDimitry Andric    front_insert_iterator& operator=(const typename Container::value_type& value);  // constexpr in C++20
352*700637cbSDimitry Andric    front_insert_iterator& operator*();  // constexpr in C++20
353*700637cbSDimitry Andric    front_insert_iterator& operator++();  // constexpr in C++20
354*700637cbSDimitry Andric    front_insert_iterator  operator++(int);  // constexpr in C++20
355*700637cbSDimitry Andric};
356*700637cbSDimitry Andric
357*700637cbSDimitry Andrictemplate <class Container> front_insert_iterator<Container> front_inserter(Container& x);  // constexpr in C++20
358*700637cbSDimitry Andric
359*700637cbSDimitry Andrictemplate <class Container>
360*700637cbSDimitry Andricclass insert_iterator
361*700637cbSDimitry Andric    : public iterator<output_iterator_tag, void, void, void, void> // until C++17
362*700637cbSDimitry Andric{
363*700637cbSDimitry Andricprotected:
364*700637cbSDimitry Andric    Container* container;
365*700637cbSDimitry Andric    typename Container::iterator iter;
366*700637cbSDimitry Andricpublic:
367*700637cbSDimitry Andric    typedef Container              container_type;
368*700637cbSDimitry Andric    typedef void                   value_type;
369*700637cbSDimitry Andric    typedef void                   difference_type; // until C++20
370*700637cbSDimitry Andric    typedef ptrdiff_t              difference_type; // since C++20
371*700637cbSDimitry Andric    typedef void                   reference;
372*700637cbSDimitry Andric    typedef void                   pointer;
373*700637cbSDimitry Andric
374*700637cbSDimitry Andric    insert_iterator(Container& x, typename Container::iterator i);  // constexpr in C++20
375*700637cbSDimitry Andric    insert_iterator& operator=(const typename Container::value_type& value);  // constexpr in C++20
376*700637cbSDimitry Andric    insert_iterator& operator*();  // constexpr in C++20
377*700637cbSDimitry Andric    insert_iterator& operator++();  // constexpr in C++20
378*700637cbSDimitry Andric    insert_iterator& operator++(int);  // constexpr in C++20
379*700637cbSDimitry Andric};
380*700637cbSDimitry Andric
381*700637cbSDimitry Andrictemplate <class Container>
382*700637cbSDimitry Andricinsert_iterator<Container> inserter(Container& x, typename Container::iterator i);  // until C++20
383*700637cbSDimitry Andrictemplate <class Container>
384*700637cbSDimitry Andricconstexpr insert_iterator<Container> inserter(Container& x, ranges::iterator_t<Container> i);  // since C++20
385*700637cbSDimitry Andric
386*700637cbSDimitry Andrictemplate <class Iterator>
387*700637cbSDimitry Andricclass move_iterator {
388*700637cbSDimitry Andricpublic:
389*700637cbSDimitry Andric    using iterator_type     = Iterator;
390*700637cbSDimitry Andric    using iterator_concept  = see below; // From C++20
391*700637cbSDimitry Andric    using iterator_category = see below; // not always present starting from C++20
392*700637cbSDimitry Andric    using value_type        = iter_value_t<Iterator>; // Until C++20, iterator_traits<Iterator>::value_type
393*700637cbSDimitry Andric    using difference_type   = iter_difference_t<Iterator>; // Until C++20, iterator_traits<Iterator>::difference_type;
394*700637cbSDimitry Andric    using pointer           = Iterator;
395*700637cbSDimitry Andric    using reference         = iter_rvalue_reference_t<Iterator>; // Until C++20, value_type&&
396*700637cbSDimitry Andric
397*700637cbSDimitry Andric    constexpr move_iterator();  // all the constexprs are in C++17
398*700637cbSDimitry Andric    constexpr explicit move_iterator(Iterator i);
399*700637cbSDimitry Andric    template <class U>
400*700637cbSDimitry Andric      constexpr move_iterator(const move_iterator<U>& u);
401*700637cbSDimitry Andric    template <class U>
402*700637cbSDimitry Andric      constexpr move_iterator& operator=(const move_iterator<U>& u);
403*700637cbSDimitry Andric
404*700637cbSDimitry Andric    constexpr iterator_type base() const; // Until C++20
405*700637cbSDimitry Andric    constexpr const Iterator& base() const & noexcept; // From C++20
406*700637cbSDimitry Andric    constexpr Iterator base() &&; // From C++20
407*700637cbSDimitry Andric
408*700637cbSDimitry Andric    constexpr reference operator*() const;
409*700637cbSDimitry Andric    constexpr pointer operator->() const; // Deprecated in C++20
410*700637cbSDimitry Andric    constexpr move_iterator& operator++();
411*700637cbSDimitry Andric    constexpr auto operator++(int); // Return type was move_iterator until C++20
412*700637cbSDimitry Andric    constexpr move_iterator& operator--();
413*700637cbSDimitry Andric    constexpr move_iterator operator--(int);
414*700637cbSDimitry Andric    constexpr move_iterator operator+(difference_type n) const;
415*700637cbSDimitry Andric    constexpr move_iterator& operator+=(difference_type n);
416*700637cbSDimitry Andric    constexpr move_iterator operator-(difference_type n) const;
417*700637cbSDimitry Andric    constexpr move_iterator& operator-=(difference_type n);
418*700637cbSDimitry Andric    constexpr reference operator[](difference_type n) const; // Return type unspecified until C++20
419*700637cbSDimitry Andric
420*700637cbSDimitry Andric    template<sentinel_for<Iterator> S>
421*700637cbSDimitry Andric      friend constexpr bool
422*700637cbSDimitry Andric        operator==(const move_iterator& x, const move_sentinel<S>& y); // Since C++20
423*700637cbSDimitry Andric    template<sized_sentinel_for<Iterator> S>
424*700637cbSDimitry Andric      friend constexpr iter_difference_t<Iterator>
425*700637cbSDimitry Andric        operator-(const move_sentinel<S>& x, const move_iterator& y); // Since C++20
426*700637cbSDimitry Andric    template<sized_sentinel_for<Iterator> S>
427*700637cbSDimitry Andric      friend constexpr iter_difference_t<Iterator>
428*700637cbSDimitry Andric        operator-(const move_iterator& x, const move_sentinel<S>& y); // Since C++20
429*700637cbSDimitry Andric    friend constexpr iter_rvalue_reference_t<Iterator>
430*700637cbSDimitry Andric      iter_move(const move_iterator& i)
431*700637cbSDimitry Andric        noexcept(noexcept(ranges::iter_move(i.current))); // Since C++20
432*700637cbSDimitry Andric    template<indirectly_swappable<Iterator> Iterator2>
433*700637cbSDimitry Andric      friend constexpr void
434*700637cbSDimitry Andric        iter_swap(const move_iterator& x, const move_iterator<Iterator2>& y)
435*700637cbSDimitry Andric          noexcept(noexcept(ranges::iter_swap(x.current, y.current))); // Since C++20
436*700637cbSDimitry Andric
437*700637cbSDimitry Andricprivate:
438*700637cbSDimitry Andric    Iterator current; // exposition only
439*700637cbSDimitry Andric};
440*700637cbSDimitry Andric
441*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
442*700637cbSDimitry Andricconstexpr bool   // constexpr in C++17
443*700637cbSDimitry Andricoperator==(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
444*700637cbSDimitry Andric
445*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
446*700637cbSDimitry Andricconstexpr bool   // constexpr in C++17
447*700637cbSDimitry Andricoperator!=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
448*700637cbSDimitry Andric
449*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
450*700637cbSDimitry Andricconstexpr bool   // constexpr in C++17
451*700637cbSDimitry Andricoperator<(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
452*700637cbSDimitry Andric
453*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
454*700637cbSDimitry Andricconstexpr bool   // constexpr in C++17
455*700637cbSDimitry Andricoperator<=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
456*700637cbSDimitry Andric
457*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
458*700637cbSDimitry Andricconstexpr bool   // constexpr in C++17
459*700637cbSDimitry Andricoperator>(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
460*700637cbSDimitry Andric
461*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
462*700637cbSDimitry Andricconstexpr bool   // constexpr in C++17
463*700637cbSDimitry Andricoperator>=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
464*700637cbSDimitry Andric
465*700637cbSDimitry Andrictemplate <class Iterator1, class Iterator2>
466*700637cbSDimitry Andricconstexpr auto   // constexpr in C++17
467*700637cbSDimitry Andricoperator-(const move_iterator<Iterator1>& x,
468*700637cbSDimitry Andric          const move_iterator<Iterator2>& y) -> decltype(x.base() - y.base());
469*700637cbSDimitry Andric
470*700637cbSDimitry Andrictemplate <class Iterator>
471*700637cbSDimitry Andricconstexpr move_iterator<Iterator> operator+(   // constexpr in C++17
472*700637cbSDimitry Andric            typename move_iterator<Iterator>::difference_type n,
473*700637cbSDimitry Andric            const move_iterator<Iterator>& x);
474*700637cbSDimitry Andric
475*700637cbSDimitry Andrictemplate <class Iterator>   // constexpr in C++17
476*700637cbSDimitry Andricconstexpr  move_iterator<Iterator> make_move_iterator(const Iterator& i);
477*700637cbSDimitry Andric
478*700637cbSDimitry Andrictemplate<class Iterator1, class Iterator2>
479*700637cbSDimitry Andric    requires (!sized_sentinel_for<Iterator1, Iterator2>)
480*700637cbSDimitry Andric  inline constexpr bool disable_sized_sentinel_for<move_iterator<Iterator1>,    // since C++20
481*700637cbSDimitry Andric                                                    move_iterator<Iterator2>> = true;
482*700637cbSDimitry Andric
483*700637cbSDimitry Andrictemplate<semiregular S>
484*700637cbSDimitry Andricclass move_sentinel {
485*700637cbSDimitry Andricpublic:
486*700637cbSDimitry Andric  constexpr move_sentinel();
487*700637cbSDimitry Andric  constexpr explicit move_sentinel(S s);
488*700637cbSDimitry Andric  template<class S2>
489*700637cbSDimitry Andric    requires convertible_to<const S2&, S>
490*700637cbSDimitry Andric      constexpr move_sentinel(const move_sentinel<S2>& s);
491*700637cbSDimitry Andric  template<class S2>
492*700637cbSDimitry Andric    requires assignable_from<S&, const S2&>
493*700637cbSDimitry Andric      constexpr move_sentinel& operator=(const move_sentinel<S2>& s);
494*700637cbSDimitry Andric
495*700637cbSDimitry Andric  constexpr S base() const;
496*700637cbSDimitry Andricprivate:
497*700637cbSDimitry Andric  S last;     // exposition only
498*700637cbSDimitry Andric};
499*700637cbSDimitry Andric
500*700637cbSDimitry Andric// [default.sentinel], default sentinel
501*700637cbSDimitry Andricstruct default_sentinel_t;
502*700637cbSDimitry Andricinline constexpr default_sentinel_t default_sentinel{};
503*700637cbSDimitry Andric
504*700637cbSDimitry Andric// [iterators.counted], counted iterators
505*700637cbSDimitry Andrictemplate<input_or_output_iterator I> class counted_iterator;
506*700637cbSDimitry Andric
507*700637cbSDimitry Andrictemplate<input_iterator I>
508*700637cbSDimitry Andric  requires see below
509*700637cbSDimitry Andric  struct iterator_traits<counted_iterator<I>>;
510*700637cbSDimitry Andric
511*700637cbSDimitry Andric// [unreachable.sentinel], unreachable sentinel
512*700637cbSDimitry Andricstruct unreachable_sentinel_t;
513*700637cbSDimitry Andricinline constexpr unreachable_sentinel_t unreachable_sentinel{};
514*700637cbSDimitry Andric
515*700637cbSDimitry Andrictemplate <class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t>
516*700637cbSDimitry Andricclass istream_iterator
517*700637cbSDimitry Andric    : public iterator<input_iterator_tag, T, Distance, const T*, const T&> // until C++17
518*700637cbSDimitry Andric{
519*700637cbSDimitry Andricpublic:
520*700637cbSDimitry Andric    typedef input_iterator_tag           iterator_category;
521*700637cbSDimitry Andric    typedef T                            value_type;
522*700637cbSDimitry Andric    typedef Distance                     difference_type;
523*700637cbSDimitry Andric    typedef const T*                     pointer;
524*700637cbSDimitry Andric    typedef const T&                     reference;
525*700637cbSDimitry Andric
526*700637cbSDimitry Andric    typedef charT                        char_type;
527*700637cbSDimitry Andric    typedef traits                       traits_type;
528*700637cbSDimitry Andric    typedef basic_istream<charT, traits> istream_type;
529*700637cbSDimitry Andric
530*700637cbSDimitry Andric    istream_iterator(); // constexpr since C++11
531*700637cbSDimitry Andric    constexpr istream_iterator(default_sentinel_t); // since C++20
532*700637cbSDimitry Andric    istream_iterator(istream_type& s);
533*700637cbSDimitry Andric    istream_iterator(const istream_iterator& x);
534*700637cbSDimitry Andric    ~istream_iterator();
535*700637cbSDimitry Andric
536*700637cbSDimitry Andric    const T& operator*() const;
537*700637cbSDimitry Andric    const T* operator->() const;
538*700637cbSDimitry Andric    istream_iterator& operator++();
539*700637cbSDimitry Andric    istream_iterator  operator++(int);
540*700637cbSDimitry Andric    friend bool operator==(const istream_iterator& i, default_sentinel_t); // since C++20
541*700637cbSDimitry Andric};
542*700637cbSDimitry Andric
543*700637cbSDimitry Andrictemplate <class T, class charT, class traits, class Distance>
544*700637cbSDimitry Andricbool operator==(const istream_iterator<T,charT,traits,Distance>& x,
545*700637cbSDimitry Andric                const istream_iterator<T,charT,traits,Distance>& y);
546*700637cbSDimitry Andrictemplate <class T, class charT, class traits, class Distance>
547*700637cbSDimitry Andricbool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
548*700637cbSDimitry Andric                const istream_iterator<T,charT,traits,Distance>& y); // until C++20
549*700637cbSDimitry Andric
550*700637cbSDimitry Andrictemplate <class T, class charT = char, class traits = char_traits<charT> >
551*700637cbSDimitry Andricclass ostream_iterator
552*700637cbSDimitry Andric    : public iterator<output_iterator_tag, void, void, void, void> // until C++17
553*700637cbSDimitry Andric{
554*700637cbSDimitry Andricpublic:
555*700637cbSDimitry Andric    typedef output_iterator_tag         iterator_category;
556*700637cbSDimitry Andric    typedef void                        value_type;
557*700637cbSDimitry Andric    typedef void                        difference_type; // until C++20
558*700637cbSDimitry Andric    typedef ptrdiff_t                   difference_type; // since C++20
559*700637cbSDimitry Andric    typedef void                        pointer;
560*700637cbSDimitry Andric    typedef void                        reference;
561*700637cbSDimitry Andric
562*700637cbSDimitry Andric    typedef charT char_type;
563*700637cbSDimitry Andric    typedef traits traits_type;
564*700637cbSDimitry Andric    typedef basic_ostream<charT,traits> ostream_type;
565*700637cbSDimitry Andric
566*700637cbSDimitry Andric    ostream_iterator(ostream_type& s);
567*700637cbSDimitry Andric    ostream_iterator(ostream_type& s, const charT* delimiter);
568*700637cbSDimitry Andric    ostream_iterator(const ostream_iterator& x);
569*700637cbSDimitry Andric    ~ostream_iterator();
570*700637cbSDimitry Andric    ostream_iterator& operator=(const T& value);
571*700637cbSDimitry Andric
572*700637cbSDimitry Andric    ostream_iterator& operator*();
573*700637cbSDimitry Andric    ostream_iterator& operator++();
574*700637cbSDimitry Andric    ostream_iterator& operator++(int);
575*700637cbSDimitry Andric};
576*700637cbSDimitry Andric
577*700637cbSDimitry Andrictemplate<class charT, class traits = char_traits<charT> >
578*700637cbSDimitry Andricclass istreambuf_iterator
579*700637cbSDimitry Andric    : public iterator<input_iterator_tag, charT, traits::off_type, unspecified, charT> // until C++17
580*700637cbSDimitry Andric{
581*700637cbSDimitry Andricpublic:
582*700637cbSDimitry Andric    typedef input_iterator_tag              iterator_category;
583*700637cbSDimitry Andric    typedef charT                           value_type;
584*700637cbSDimitry Andric    typedef traits::off_type                difference_type;
585*700637cbSDimitry Andric    typedef unspecified                     pointer;
586*700637cbSDimitry Andric    typedef charT                           reference;
587*700637cbSDimitry Andric
588*700637cbSDimitry Andric    typedef charT                           char_type;
589*700637cbSDimitry Andric    typedef traits                          traits_type;
590*700637cbSDimitry Andric    typedef traits::int_type                int_type;
591*700637cbSDimitry Andric    typedef basic_streambuf<charT, traits>  streambuf_type;
592*700637cbSDimitry Andric    typedef basic_istream<charT, traits>    istream_type;
593*700637cbSDimitry Andric
594*700637cbSDimitry Andric    istreambuf_iterator() noexcept; // constexpr since C++11
595*700637cbSDimitry Andric    constexpr istreambuf_iterator(default_sentinel_t) noexcept; // since C++20
596*700637cbSDimitry Andric    istreambuf_iterator(istream_type& s) noexcept;
597*700637cbSDimitry Andric    istreambuf_iterator(streambuf_type* s) noexcept;
598*700637cbSDimitry Andric    istreambuf_iterator(a-private-type) noexcept;
599*700637cbSDimitry Andric
600*700637cbSDimitry Andric    charT                operator*() const;
601*700637cbSDimitry Andric    pointer operator->() const;
602*700637cbSDimitry Andric    istreambuf_iterator& operator++();
603*700637cbSDimitry Andric    a-private-type       operator++(int);
604*700637cbSDimitry Andric
605*700637cbSDimitry Andric    bool equal(const istreambuf_iterator& b) const;
606*700637cbSDimitry Andric    friend bool operator==(const istreambuf_iterator& i, default_sentinel_t s); // since C++20
607*700637cbSDimitry Andric};
608*700637cbSDimitry Andric
609*700637cbSDimitry Andrictemplate <class charT, class traits>
610*700637cbSDimitry Andricbool operator==(const istreambuf_iterator<charT,traits>& a,
611*700637cbSDimitry Andric                const istreambuf_iterator<charT,traits>& b);
612*700637cbSDimitry Andrictemplate <class charT, class traits>
613*700637cbSDimitry Andricbool operator!=(const istreambuf_iterator<charT,traits>& a,
614*700637cbSDimitry Andric                const istreambuf_iterator<charT,traits>& b); // until C++20
615*700637cbSDimitry Andric
616*700637cbSDimitry Andrictemplate <class charT, class traits = char_traits<charT> >
617*700637cbSDimitry Andricclass ostreambuf_iterator
618*700637cbSDimitry Andric    : public iterator<output_iterator_tag, void, void, void, void> // until C++17
619*700637cbSDimitry Andric{
620*700637cbSDimitry Andricpublic:
621*700637cbSDimitry Andric    typedef output_iterator_tag            iterator_category;
622*700637cbSDimitry Andric    typedef void                           value_type;
623*700637cbSDimitry Andric    typedef void                           difference_type; // until C++20
624*700637cbSDimitry Andric    typedef ptrdiff_t                      difference_type; // since C++20
625*700637cbSDimitry Andric    typedef void                           pointer;
626*700637cbSDimitry Andric    typedef void                           reference;
627*700637cbSDimitry Andric
628*700637cbSDimitry Andric    typedef charT                          char_type;
629*700637cbSDimitry Andric    typedef traits                         traits_type;
630*700637cbSDimitry Andric    typedef basic_streambuf<charT, traits> streambuf_type;
631*700637cbSDimitry Andric    typedef basic_ostream<charT, traits>   ostream_type;
632*700637cbSDimitry Andric
633*700637cbSDimitry Andric    ostreambuf_iterator(ostream_type& s) noexcept;
634*700637cbSDimitry Andric    ostreambuf_iterator(streambuf_type* s) noexcept;
635*700637cbSDimitry Andric    ostreambuf_iterator& operator=(charT c);
636*700637cbSDimitry Andric    ostreambuf_iterator& operator*();
637*700637cbSDimitry Andric    ostreambuf_iterator& operator++();
638*700637cbSDimitry Andric    ostreambuf_iterator& operator++(int);
639*700637cbSDimitry Andric    bool failed() const noexcept;
640*700637cbSDimitry Andric};
641*700637cbSDimitry Andric
642*700637cbSDimitry Andrictemplate <class C> constexpr auto begin(C& c) -> decltype(c.begin());                   // constexpr since C++17
643*700637cbSDimitry Andrictemplate <class C> constexpr auto begin(const C& c) -> decltype(c.begin());             // constexpr since C++17
644*700637cbSDimitry Andrictemplate <class C> constexpr auto end(C& c) -> decltype(c.end());                       // constexpr since C++17
645*700637cbSDimitry Andrictemplate <class C> constexpr auto end(const C& c) -> decltype(c.end());                 // constexpr since C++17
646*700637cbSDimitry Andrictemplate <class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept;
647*700637cbSDimitry Andrictemplate <class T, size_t N> constexpr T* end(T (&array)[N]) noexcept;
648*700637cbSDimitry Andric
649*700637cbSDimitry Andrictemplate <class C> constexpr auto cbegin(const C& c) noexcept(see-below) -> decltype(std::begin(c)); // C++14
650*700637cbSDimitry Andrictemplate <class C> constexpr auto cend(const C& c) noexcept(see-below) -> decltype(std::end(c));     // C++14
651*700637cbSDimitry Andrictemplate <class C> constexpr auto rbegin(C& c) -> decltype(c.rbegin());                 // C++14, constexpr since C++17
652*700637cbSDimitry Andrictemplate <class C> constexpr auto rbegin(const C& c) -> decltype(c.rbegin());           // C++14, constexpr since C++17
653*700637cbSDimitry Andrictemplate <class C> constexpr auto rend(C& c) -> decltype(c.rend());                     // C++14, constexpr since C++17
654*700637cbSDimitry Andrictemplate <class C> constexpr auto rend(const C& c) -> decltype(c.rend());               // C++14, constexpr since C++17
655*700637cbSDimitry Andrictemplate <class E> constexpr reverse_iterator<const E*> rbegin(initializer_list<E> il); // C++14, constexpr since C++17
656*700637cbSDimitry Andrictemplate <class E> constexpr reverse_iterator<const E*> rend(initializer_list<E> il);   // C++14, constexpr since C++17
657*700637cbSDimitry Andrictemplate <class T, size_t N> constexpr reverse_iterator<T*> rbegin(T (&array)[N]);      // C++14, constexpr since C++17
658*700637cbSDimitry Andrictemplate <class T, size_t N> constexpr reverse_iterator<T*> rend(T (&array)[N]);        // C++14, constexpr since C++17
659*700637cbSDimitry Andrictemplate <class C> constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c));      // C++14, constexpr since C++17
660*700637cbSDimitry Andrictemplate <class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));          // C++14, constexpr since C++17
661*700637cbSDimitry Andric
662*700637cbSDimitry Andric// 24.8, container access:
663*700637cbSDimitry Andrictemplate <class C> constexpr auto size(const C& c) -> decltype(c.size());         // C++17
664*700637cbSDimitry Andrictemplate <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
665*700637cbSDimitry Andric
666*700637cbSDimitry Andrictemplate <class C> constexpr auto ssize(const C& c)
667*700637cbSDimitry Andric    -> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>;                    // C++20
668*700637cbSDimitry Andrictemplate <class T, ptrdiff_t> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; // C++20
669*700637cbSDimitry Andric
670*700637cbSDimitry Andrictemplate <class C> constexpr auto empty(const C& c) -> decltype(c.empty());       // C++17
671*700637cbSDimitry Andrictemplate <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;  // C++17
672*700637cbSDimitry Andrictemplate <class E> constexpr bool empty(initializer_list<E> il) noexcept;         // C++17
673*700637cbSDimitry Andrictemplate <class C> constexpr auto data(C& c) -> decltype(c.data());               // C++17
674*700637cbSDimitry Andrictemplate <class C> constexpr auto data(const C& c) -> decltype(c.data());         // C++17
675*700637cbSDimitry Andrictemplate <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;           // C++17
676*700637cbSDimitry Andrictemplate <class E> constexpr const E* data(initializer_list<E> il) noexcept;      // C++17
677*700637cbSDimitry Andric
678*700637cbSDimitry Andric}  // std
679*700637cbSDimitry Andric
680*700637cbSDimitry Andric*/
681*700637cbSDimitry Andric
682*700637cbSDimitry Andric#include <__cxx03/__config>
683*700637cbSDimitry Andric#include <__cxx03/__iterator/access.h>
684*700637cbSDimitry Andric#include <__cxx03/__iterator/advance.h>
685*700637cbSDimitry Andric#include <__cxx03/__iterator/back_insert_iterator.h>
686*700637cbSDimitry Andric#include <__cxx03/__iterator/distance.h>
687*700637cbSDimitry Andric#include <__cxx03/__iterator/front_insert_iterator.h>
688*700637cbSDimitry Andric#include <__cxx03/__iterator/insert_iterator.h>
689*700637cbSDimitry Andric#include <__cxx03/__iterator/istream_iterator.h>
690*700637cbSDimitry Andric#include <__cxx03/__iterator/istreambuf_iterator.h>
691*700637cbSDimitry Andric#include <__cxx03/__iterator/iterator.h>
692*700637cbSDimitry Andric#include <__cxx03/__iterator/iterator_traits.h>
693*700637cbSDimitry Andric#include <__cxx03/__iterator/move_iterator.h>
694*700637cbSDimitry Andric#include <__cxx03/__iterator/next.h>
695*700637cbSDimitry Andric#include <__cxx03/__iterator/ostream_iterator.h>
696*700637cbSDimitry Andric#include <__cxx03/__iterator/ostreambuf_iterator.h>
697*700637cbSDimitry Andric#include <__cxx03/__iterator/prev.h>
698*700637cbSDimitry Andric#include <__cxx03/__iterator/reverse_iterator.h>
699*700637cbSDimitry Andric#include <__cxx03/__iterator/wrap_iter.h>
700*700637cbSDimitry Andric
701*700637cbSDimitry Andric#include <__cxx03/version>
702*700637cbSDimitry Andric
703*700637cbSDimitry Andric// standard-mandated includes
704*700637cbSDimitry Andric
705*700637cbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
706*700637cbSDimitry Andric#  pragma GCC system_header
707*700637cbSDimitry Andric#endif
708*700637cbSDimitry Andric
709*700637cbSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
710*700637cbSDimitry Andric#  include <__cxx03/cstdlib>
711*700637cbSDimitry Andric#  include <__cxx03/exception>
712*700637cbSDimitry Andric#  include <__cxx03/new>
713*700637cbSDimitry Andric#  include <__cxx03/type_traits>
714*700637cbSDimitry Andric#  include <__cxx03/typeinfo>
715*700637cbSDimitry Andric#  include <__cxx03/utility>
716*700637cbSDimitry Andric#endif
717*700637cbSDimitry Andric
718*700637cbSDimitry Andric#endif // _LIBCPP___CXX03_ITERATOR
719