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: libcpp-has-no-incomplete-ranges 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 template<std::ranges::range R> 28 requires std::input_iterator<std::ranges::iterator_t<R>> 29 constexpr bool check_input_range_subsumption() { 30 return false; 31 } 32 33 template<std::ranges::input_range> 34 requires true 35 constexpr bool check_input_range_subsumption() { 36 return true; 37 } 38 39 static_assert(check_input_range_subsumption<range>()); 40 41 template<std::ranges::input_range R> 42 requires std::forward_iterator<std::ranges::iterator_t<R>> 43 constexpr bool check_forward_range_subsumption() { 44 return false; 45 } 46 47 template<std::ranges::forward_range> 48 requires true 49 constexpr bool check_forward_range_subsumption() { 50 return true; 51 } 52 53 static_assert(check_forward_range_subsumption<range>()); 54 55 template<std::ranges::forward_range R> 56 requires std::bidirectional_iterator<std::ranges::iterator_t<R>> 57 constexpr bool check_bidirectional_range_subsumption() { 58 return false; 59 } 60 61 template<std::ranges::bidirectional_range> 62 requires true 63 constexpr bool check_bidirectional_range_subsumption() { 64 return true; 65 } 66 67 static_assert(check_bidirectional_range_subsumption<range>()); 68 69 template<std::ranges::bidirectional_range R> 70 requires std::random_access_iterator<std::ranges::iterator_t<R>> 71 constexpr bool check_random_access_range_subsumption() { 72 return false; 73 } 74 75 template<std::ranges::random_access_range> 76 requires true 77 constexpr bool check_random_access_range_subsumption() { 78 return true; 79 } 80 81 static_assert(check_random_access_range_subsumption<range>()); 82 83 template<std::ranges::random_access_range R> 84 requires std::random_access_iterator<std::ranges::iterator_t<R>> 85 constexpr bool check_contiguous_range_subsumption() { 86 return false; 87 } 88 89 template<std::ranges::contiguous_range> 90 requires true 91 constexpr bool check_contiguous_range_subsumption() { 92 return true; 93 } 94 95 static_assert(check_contiguous_range_subsumption<range>()); 96