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 R> 13 // concept __nothrow_forward_range; 14 15 #include <memory> 16 17 #include "test_iterators.h" 18 #include "test_range.h" 19 20 // Has to be a template to work with `test_range`. 21 template <typename> 22 struct ForwardProxyIterator { 23 using value_type = int; 24 using difference_type = int; 25 ForwardProxyIterator& operator++(); 26 ForwardProxyIterator operator++(int); 27 bool operator==(const ForwardProxyIterator&) const; 28 29 int operator*() const; 30 }; 31 32 static_assert(std::ranges::__nothrow_forward_range<test_range<forward_iterator>>); 33 static_assert(!std::ranges::__nothrow_forward_range<test_range<cpp20_input_iterator>>); 34 static_assert(std::ranges::forward_range<test_range<ForwardProxyIterator>>); 35 static_assert(!std::ranges::__nothrow_forward_range<test_range<ForwardProxyIterator>>); 36 forward_subsumes_input(std::ranges::__nothrow_forward_range auto &&)37constexpr bool forward_subsumes_input(std::ranges::__nothrow_forward_range auto&&) { 38 return true; 39 } 40 constexpr bool forward_subsumes_input(std::ranges::__nothrow_input_range auto&&); 41 42 static_assert(forward_subsumes_input("foo")); 43