]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis_c++20.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 24_iterators / headers / iterator / synopsis_c++20.cc
CommitLineData
8d9254fc 1// Copyright (C) 2019-2020 Free Software Foundation, Inc.
6d0dff49
JW
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-options "-std=gnu++2a" }
19// { dg-do compile { target c++2a } }
20// { dg-require-normal-namespace "" }
21
22#include <iterator>
23#include "./synopsis_c++17.cc"
24
25namespace std
26{
27 template<class> struct incrementable_traits;
28 template<class> struct readable_traits;
29
30 struct contiguous_iterator_tag;
31
32 namespace ranges
33 {
34 template<input_or_output_iterator I, sentinel_for<I> S>
35 constexpr iter_difference_t<I> distance(I first, S last);
36 template<range R>
37 constexpr range_difference_t<R> distance(R&& r);
38
39 template<input_or_output_iterator I>
40 constexpr I next(I x);
41 template<input_or_output_iterator I>
42 constexpr I next(I x, iter_difference_t<I> n);
43 template<input_or_output_iterator I, sentinel_for<I> S>
44 constexpr I next(I x, S bound);
45 template<input_or_output_iterator I, sentinel_for<I> S>
46 constexpr I next(I x, iter_difference_t<I> n, S bound);
47
48 template<bidirectional_iterator I>
49 constexpr I prev(I x);
50 template<bidirectional_iterator I>
51 constexpr I prev(I x, iter_difference_t<I> n);
52 template<bidirectional_iterator I>
53 constexpr I prev(I x, iter_difference_t<I> n, I bound);
54 }
55
56 template<semiregular S> class move_sentinel;
57
58 template<input_or_output_iterator I, sentinel_for<I> S>
59 requires (!same_as<I, S>)
60 class common_iterator;
61
62 template<class I, class S>
63 struct incrementable_traits<common_iterator<I, S>>;
64
65 template<input_iterator I, class S>
66 struct iterator_traits<common_iterator<I, S>>;
67
68 struct default_sentinel_t;
69
70 template<input_or_output_iterator I> class counted_iterator;
71
72 template<class I>
73 struct incrementable_traits<counted_iterator<I>>;
74
75 template<input_iterator I>
76 struct iterator_traits<counted_iterator<I>>;
77
78 struct unreachable_sentinel_t;
79}
80
328b52d6 81struct I { };
d99828ee 82template<> constexpr bool std::disable_sized_sentinel_for<I, I> = true;
328b52d6 83
6d0dff49
JW
84namespace __gnu_test
85{
86 // customization points
87 constexpr auto* iter_move = &std::ranges::iter_move;
88 constexpr auto* iter_swap = &std::ranges::iter_swap;
89 // sized sentinels
d99828ee
JW
90 constexpr bool const* disable_sized_sentinel_for
91 = &std::disable_sized_sentinel_for<void, void>;
6d0dff49
JW
92 // default sentinels
93 constexpr std::default_sentinel_t const* default_sentinel
94 = &std::default_sentinel;
95 // unreachable sentinels
96 constexpr std::unreachable_sentinel_t const* unreachable_sentinel
97 = &std::unreachable_sentinel;
98}