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 11d8fad661SChristopher Di Bella // template<class T> 12d8fad661SChristopher Di Bella // concept input_iterator; 13d8fad661SChristopher Di Bella 14d8fad661SChristopher Di Bella // std::ranges::forward_range 15d8fad661SChristopher Di Bella 16d8fad661SChristopher Di Bella #include <ranges> 17d8fad661SChristopher Di Bella 18d8fad661SChristopher Di Bella #include <iterator> 19d8fad661SChristopher Di Bella 20d8fad661SChristopher Di Bella struct range { 21d8fad661SChristopher Di Bella int* begin(); 22d8fad661SChristopher Di Bella int* end(); 23d8fad661SChristopher Di Bella }; 24d8fad661SChristopher Di Bella 25d8fad661SChristopher Di Bella template<std::ranges::range R> 26d8fad661SChristopher Di Bella requires std::input_iterator<std::ranges::iterator_t<R>> check_input_range_subsumption()27*88b73a98SLouis Dionneconstexpr bool check_input_range_subsumption() { 28d8fad661SChristopher Di Bella return false; 29d8fad661SChristopher Di Bella } 30d8fad661SChristopher Di Bella 31d8fad661SChristopher Di Bella template<std::ranges::input_range> 32d8fad661SChristopher Di Bella requires true check_input_range_subsumption()33*88b73a98SLouis Dionneconstexpr bool check_input_range_subsumption() { 34d8fad661SChristopher Di Bella return true; 35d8fad661SChristopher Di Bella } 36d8fad661SChristopher Di Bella 37d8fad661SChristopher Di Bella static_assert(check_input_range_subsumption<range>()); 38d8fad661SChristopher Di Bella 39d8fad661SChristopher Di Bella template<std::ranges::input_range R> 40d8fad661SChristopher Di Bella requires std::forward_iterator<std::ranges::iterator_t<R>> check_forward_range_subsumption()41*88b73a98SLouis Dionneconstexpr bool check_forward_range_subsumption() { 42d8fad661SChristopher Di Bella return false; 43d8fad661SChristopher Di Bella } 44d8fad661SChristopher Di Bella 45d8fad661SChristopher Di Bella template<std::ranges::forward_range> 46d8fad661SChristopher Di Bella requires true check_forward_range_subsumption()47*88b73a98SLouis Dionneconstexpr bool check_forward_range_subsumption() { 48d8fad661SChristopher Di Bella return true; 49d8fad661SChristopher Di Bella } 50d8fad661SChristopher Di Bella 51d8fad661SChristopher Di Bella static_assert(check_forward_range_subsumption<range>()); 52d8fad661SChristopher Di Bella 53d8fad661SChristopher Di Bella template<std::ranges::forward_range R> 54d8fad661SChristopher Di Bella requires std::bidirectional_iterator<std::ranges::iterator_t<R>> check_bidirectional_range_subsumption()55*88b73a98SLouis Dionneconstexpr bool check_bidirectional_range_subsumption() { 56d8fad661SChristopher Di Bella return false; 57d8fad661SChristopher Di Bella } 58d8fad661SChristopher Di Bella 59d8fad661SChristopher Di Bella template<std::ranges::bidirectional_range> 60d8fad661SChristopher Di Bella requires true check_bidirectional_range_subsumption()61*88b73a98SLouis Dionneconstexpr bool check_bidirectional_range_subsumption() { 62d8fad661SChristopher Di Bella return true; 63d8fad661SChristopher Di Bella } 64d8fad661SChristopher Di Bella 65d8fad661SChristopher Di Bella static_assert(check_bidirectional_range_subsumption<range>()); 66d8fad661SChristopher Di Bella 67d8fad661SChristopher Di Bella template<std::ranges::bidirectional_range R> 68d8fad661SChristopher Di Bella requires std::random_access_iterator<std::ranges::iterator_t<R>> check_random_access_range_subsumption()69d8fad661SChristopher Di Bellaconstexpr bool check_random_access_range_subsumption() { 70d8fad661SChristopher Di Bella return false; 71d8fad661SChristopher Di Bella } 72d8fad661SChristopher Di Bella 73d8fad661SChristopher Di Bella template<std::ranges::random_access_range> 74d8fad661SChristopher Di Bella requires true check_random_access_range_subsumption()75d8fad661SChristopher Di Bellaconstexpr bool check_random_access_range_subsumption() { 76d8fad661SChristopher Di Bella return true; 77d8fad661SChristopher Di Bella } 78d8fad661SChristopher Di Bella 79d8fad661SChristopher Di Bella static_assert(check_random_access_range_subsumption<range>()); 8034503987Szoecarver 8134503987Szoecarver template<std::ranges::random_access_range R> 8234503987Szoecarver requires std::random_access_iterator<std::ranges::iterator_t<R>> check_contiguous_range_subsumption()8334503987Szoecarverconstexpr bool check_contiguous_range_subsumption() { 8434503987Szoecarver return false; 8534503987Szoecarver } 8634503987Szoecarver 8734503987Szoecarver template<std::ranges::contiguous_range> 8834503987Szoecarver requires true check_contiguous_range_subsumption()8934503987Szoecarverconstexpr bool check_contiguous_range_subsumption() { 9034503987Szoecarver return true; 9134503987Szoecarver } 9234503987Szoecarver 9334503987Szoecarver static_assert(check_contiguous_range_subsumption<range>()); 94