1*d8fad661SChristopher Di Bella //===----------------------------------------------------------------------===//
2*d8fad661SChristopher Di Bella //
3*d8fad661SChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*d8fad661SChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information.
5*d8fad661SChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*d8fad661SChristopher Di Bella //
7*d8fad661SChristopher Di Bella //===----------------------------------------------------------------------===//
8*d8fad661SChristopher Di Bella 
9*d8fad661SChristopher Di Bella // UNSUPPORTED: c++03, c++11, c++14, c++17
10*d8fad661SChristopher Di Bella // UNSUPPORTED: libcpp-no-concepts
11*d8fad661SChristopher Di Bella // UNSUPPORTED: gcc-10
12*d8fad661SChristopher Di Bella 
13*d8fad661SChristopher Di Bella // template<class T>
14*d8fad661SChristopher Di Bella // concept input_iterator;
15*d8fad661SChristopher Di Bella 
16*d8fad661SChristopher Di Bella // std::ranges::forward_range
17*d8fad661SChristopher Di Bella 
18*d8fad661SChristopher Di Bella #include <ranges>
19*d8fad661SChristopher Di Bella 
20*d8fad661SChristopher Di Bella #include <iterator>
21*d8fad661SChristopher Di Bella 
22*d8fad661SChristopher Di Bella struct range {
23*d8fad661SChristopher Di Bella   int* begin();
24*d8fad661SChristopher Di Bella   int* end();
25*d8fad661SChristopher Di Bella };
26*d8fad661SChristopher Di Bella 
27*d8fad661SChristopher Di Bella // clang-format off
28*d8fad661SChristopher Di Bella template<std::ranges::range R>
29*d8fad661SChristopher Di Bella requires std::input_iterator<std::ranges::iterator_t<R> >
30*d8fad661SChristopher Di Bella [[nodiscard]] constexpr bool check_input_range_subsumption() {
31*d8fad661SChristopher Di Bella   return false;
32*d8fad661SChristopher Di Bella }
33*d8fad661SChristopher Di Bella 
34*d8fad661SChristopher Di Bella template<std::ranges::input_range>
35*d8fad661SChristopher Di Bella requires true
36*d8fad661SChristopher Di Bella [[nodiscard]] constexpr bool check_input_range_subsumption() {
37*d8fad661SChristopher Di Bella   return true;
38*d8fad661SChristopher Di Bella }
39*d8fad661SChristopher Di Bella // clang-format on
40*d8fad661SChristopher Di Bella 
41*d8fad661SChristopher Di Bella static_assert(check_input_range_subsumption<range>());
42*d8fad661SChristopher Di Bella 
43*d8fad661SChristopher Di Bella // clang-format off
44*d8fad661SChristopher Di Bella template<std::ranges::input_range R>
45*d8fad661SChristopher Di Bella requires std::forward_iterator<std::ranges::iterator_t<R> >
46*d8fad661SChristopher Di Bella [[nodiscard]] constexpr bool check_forward_range_subsumption() {
47*d8fad661SChristopher Di Bella   return false;
48*d8fad661SChristopher Di Bella }
49*d8fad661SChristopher Di Bella 
50*d8fad661SChristopher Di Bella template<std::ranges::forward_range>
51*d8fad661SChristopher Di Bella requires true
52*d8fad661SChristopher Di Bella [[nodiscard]] constexpr bool check_forward_range_subsumption() {
53*d8fad661SChristopher Di Bella   return true;
54*d8fad661SChristopher Di Bella }
55*d8fad661SChristopher Di Bella // clang-format on
56*d8fad661SChristopher Di Bella 
57*d8fad661SChristopher Di Bella static_assert(check_forward_range_subsumption<range>());
58*d8fad661SChristopher Di Bella 
59*d8fad661SChristopher Di Bella // clang-format off
60*d8fad661SChristopher Di Bella template<std::ranges::forward_range R>
61*d8fad661SChristopher Di Bella requires std::bidirectional_iterator<std::ranges::iterator_t<R> >
62*d8fad661SChristopher Di Bella [[nodiscard]] constexpr bool check_bidirectional_range_subsumption() {
63*d8fad661SChristopher Di Bella   return false;
64*d8fad661SChristopher Di Bella }
65*d8fad661SChristopher Di Bella 
66*d8fad661SChristopher Di Bella template<std::ranges::bidirectional_range>
67*d8fad661SChristopher Di Bella requires true
68*d8fad661SChristopher Di Bella [[nodiscard]] constexpr bool check_bidirectional_range_subsumption() {
69*d8fad661SChristopher Di Bella   return true;
70*d8fad661SChristopher Di Bella }
71*d8fad661SChristopher Di Bella // clang-format on
72*d8fad661SChristopher Di Bella 
73*d8fad661SChristopher Di Bella static_assert(check_bidirectional_range_subsumption<range>());
74*d8fad661SChristopher Di Bella 
75*d8fad661SChristopher Di Bella template<std::ranges::bidirectional_range R>
76*d8fad661SChristopher Di Bella requires std::random_access_iterator<std::ranges::iterator_t<R> >
77*d8fad661SChristopher Di Bella constexpr bool check_random_access_range_subsumption() {
78*d8fad661SChristopher Di Bella   return false;
79*d8fad661SChristopher Di Bella }
80*d8fad661SChristopher Di Bella 
81*d8fad661SChristopher Di Bella template<std::ranges::random_access_range>
82*d8fad661SChristopher Di Bella requires true
83*d8fad661SChristopher Di Bella constexpr bool check_random_access_range_subsumption() {
84*d8fad661SChristopher Di Bella   return true;
85*d8fad661SChristopher Di Bella }
86*d8fad661SChristopher Di Bella 
87*d8fad661SChristopher Di Bella static_assert(check_random_access_range_subsumption<range>());
88