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