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-has-no-incomplete-ranges 11 12 // template<class T> 13 // concept input_iterator; 14 15 // std::ranges::forward_range 16 17 #include <ranges> 18 19 #include <iterator> 20 21 struct range { 22 int* begin(); 23 int* end(); 24 }; 25 26 template<std::ranges::range R> 27 requires std::input_iterator<std::ranges::iterator_t<R>> 28 constexpr bool check_input_range_subsumption() { 29 return false; 30 } 31 32 template<std::ranges::input_range> 33 requires true 34 constexpr bool check_input_range_subsumption() { 35 return true; 36 } 37 38 static_assert(check_input_range_subsumption<range>()); 39 40 template<std::ranges::input_range R> 41 requires std::forward_iterator<std::ranges::iterator_t<R>> 42 constexpr bool check_forward_range_subsumption() { 43 return false; 44 } 45 46 template<std::ranges::forward_range> 47 requires true 48 constexpr bool check_forward_range_subsumption() { 49 return true; 50 } 51 52 static_assert(check_forward_range_subsumption<range>()); 53 54 template<std::ranges::forward_range R> 55 requires std::bidirectional_iterator<std::ranges::iterator_t<R>> 56 constexpr bool check_bidirectional_range_subsumption() { 57 return false; 58 } 59 60 template<std::ranges::bidirectional_range> 61 requires true 62 constexpr bool check_bidirectional_range_subsumption() { 63 return true; 64 } 65 66 static_assert(check_bidirectional_range_subsumption<range>()); 67 68 template<std::ranges::bidirectional_range R> 69 requires std::random_access_iterator<std::ranges::iterator_t<R>> 70 constexpr bool check_random_access_range_subsumption() { 71 return false; 72 } 73 74 template<std::ranges::random_access_range> 75 requires true 76 constexpr bool check_random_access_range_subsumption() { 77 return true; 78 } 79 80 static_assert(check_random_access_range_subsumption<range>()); 81 82 template<std::ranges::random_access_range R> 83 requires std::random_access_iterator<std::ranges::iterator_t<R>> 84 constexpr bool check_contiguous_range_subsumption() { 85 return false; 86 } 87 88 template<std::ranges::contiguous_range> 89 requires true 90 constexpr bool check_contiguous_range_subsumption() { 91 return true; 92 } 93 94 static_assert(check_contiguous_range_subsumption<range>()); 95