| 1 |
// Copyright (C) 2019-2025 Free Software Foundation, Inc. |
| 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-do compile { target c++20 } } |
| 19 |
// { dg-require-normal-namespace "" } |
| 20 |
|
| 21 |
#include <iterator> |
| 22 |
#include "./synopsis_c++17.cc" |
| 23 |
|
| 24 |
namespace std |
| 25 |
{ |
| 26 |
template<class> struct incrementable_traits; |
| 27 |
template<class> struct readable_traits; |
| 28 |
|
| 29 |
struct contiguous_iterator_tag; |
| 30 |
|
| 31 |
namespace ranges |
| 32 |
{ |
| 33 |
// These are function objects of unspecified type. |
| 34 |
auto& _distance = distance; |
| 35 |
auto& _advance = advance; |
| 36 |
auto& _next = next; |
| 37 |
auto& _prev = prev; |
| 38 |
} |
| 39 |
|
| 40 |
template<semiregular S> class move_sentinel; |
| 41 |
|
| 42 |
template<input_or_output_iterator I, sentinel_for<I> S> |
| 43 |
requires (!same_as<I, S>) && copyable<I> |
| 44 |
class common_iterator; |
| 45 |
|
| 46 |
template<class I, class S> |
| 47 |
struct incrementable_traits<common_iterator<I, S>>; |
| 48 |
|
| 49 |
template<input_iterator I, class S> |
| 50 |
struct iterator_traits<common_iterator<I, S>>; |
| 51 |
|
| 52 |
struct default_sentinel_t; |
| 53 |
|
| 54 |
template<input_or_output_iterator I> class counted_iterator; |
| 55 |
|
| 56 |
template<class I> |
| 57 |
struct incrementable_traits<counted_iterator<I>>; |
| 58 |
|
| 59 |
template<input_iterator I> |
| 60 |
requires same_as<__detail::__iter_traits<I>, iterator_traits<I>> |
| 61 |
struct iterator_traits<counted_iterator<I>>; |
| 62 |
|
| 63 |
struct unreachable_sentinel_t; |
| 64 |
} |
| 65 |
|
| 66 |
struct I { }; |
| 67 |
template<> constexpr bool std::disable_sized_sentinel_for<I, I> = true; |
| 68 |
|
| 69 |
namespace __gnu_test |
| 70 |
{ |
| 71 |
// customization points |
| 72 |
constexpr auto* iter_move = &std::ranges::iter_move; |
| 73 |
constexpr auto* iter_swap = &std::ranges::iter_swap; |
| 74 |
// sized sentinels |
| 75 |
constexpr bool const* disable_sized_sentinel_for |
| 76 |
= &std::disable_sized_sentinel_for<void, void>; |
| 77 |
// default sentinels |
| 78 |
constexpr std::default_sentinel_t const* default_sentinel |
| 79 |
= &std::default_sentinel; |
| 80 |
// unreachable sentinels |
| 81 |
constexpr std::unreachable_sentinel_t const* unreachable_sentinel |
| 82 |
= &std::unreachable_sentinel; |
| 83 |
} |