1*d8fad661SChristopher Di Bella //===----------------------------------------------------------------------===//
2*d8fad661SChristopher Di Bella //
3*d8fad661SChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*d8fad661SChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information.
5*d8fad661SChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*d8fad661SChristopher Di Bella //
7*d8fad661SChristopher Di Bella //===----------------------------------------------------------------------===//
8*d8fad661SChristopher Di Bella 
9*d8fad661SChristopher Di Bella // UNSUPPORTED: c++03, c++11, c++14, c++17
10*d8fad661SChristopher Di Bella // UNSUPPORTED: libcpp-no-concepts
11*d8fad661SChristopher Di Bella // UNSUPPORTED: gcc-10
12*d8fad661SChristopher Di Bella 
13*d8fad661SChristopher Di Bella // template<range _Rp>
14*d8fad661SChristopher Di Bella // concept bidirectional_range;
15*d8fad661SChristopher Di Bella 
16*d8fad661SChristopher Di Bella #include <ranges>
17*d8fad661SChristopher Di Bella 
18*d8fad661SChristopher Di Bella #include "test_range.h"
19*d8fad661SChristopher Di Bella 
20*d8fad661SChristopher Di Bella namespace stdr = std::ranges;
21*d8fad661SChristopher Di Bella 
22*d8fad661SChristopher Di Bella template <template <class...> class I>
23*d8fad661SChristopher Di Bella constexpr bool check_bidirectional_range() {
24*d8fad661SChristopher Di Bella   constexpr bool result = stdr::bidirectional_range<test_range<I> >;
25*d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_range<I> const> == result);
26*d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_non_const_common_range<I> > == result);
27*d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_non_const_range<I> > == result);
28*d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_common_range<I> > == result);
29*d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_common_range<I> const> == result);
30*d8fad661SChristopher Di Bella   static_assert(!stdr::bidirectional_range<test_non_const_common_range<I> const>);
31*d8fad661SChristopher Di Bella   static_assert(!stdr::bidirectional_range<test_non_const_range<I> const>);
32*d8fad661SChristopher Di Bella   return result;
33*d8fad661SChristopher Di Bella }
34*d8fad661SChristopher Di Bella 
35*d8fad661SChristopher Di Bella static_assert(!check_bidirectional_range<cpp17_input_iterator>());
36*d8fad661SChristopher Di Bella static_assert(!check_bidirectional_range<cpp20_input_iterator>());
37*d8fad661SChristopher Di Bella static_assert(!check_bidirectional_range<forward_iterator>());
38*d8fad661SChristopher Di Bella static_assert(check_bidirectional_range<bidirectional_iterator>());
39*d8fad661SChristopher Di Bella static_assert(check_bidirectional_range<random_access_iterator>());
40*d8fad661SChristopher Di Bella static_assert(check_bidirectional_range<contiguous_iterator>());
41