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 // std::ranges::forward_range; 14 15 #include <ranges> 16 17 #include "test_iterators.h" 18 #include "test_range.h" 19 20 namespace stdr = std::ranges; 21 22 template <template <class...> class I> 23 constexpr bool check_forward_range() { 24 constexpr bool result = stdr::forward_range<test_range<I> >; 25 static_assert(stdr::forward_range<test_range<I> const> == result); 26 static_assert(stdr::forward_range<test_non_const_common_range<I> > == result); 27 static_assert(stdr::forward_range<test_non_const_range<I> > == result); 28 static_assert(stdr::forward_range<test_common_range<I> > == result); 29 static_assert(stdr::forward_range<test_common_range<I> const> == result); 30 static_assert(!stdr::forward_range<test_non_const_common_range<I> const>); 31 static_assert(!stdr::forward_range<test_non_const_range<I> const>); 32 return result; 33 } 34 35 static_assert(!check_forward_range<cpp17_input_iterator>()); 36 static_assert(!check_forward_range<cpp20_input_iterator>()); 37 static_assert(check_forward_range<forward_iterator>()); 38 static_assert(check_forward_range<bidirectional_iterator>()); 39 static_assert(check_forward_range<random_access_iterator>()); 40 static_assert(check_forward_range<contiguous_iterator>()); 41