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