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 // UNSUPPORTED: libcpp-no-concepts
11d8fad661SChristopher Di Bella // UNSUPPORTED: gcc-10
12d8fad661SChristopher Di Bella 
13*f192616cSLouis Dionne // template<class R>
14d8fad661SChristopher Di Bella // concept bidirectional_range;
15d8fad661SChristopher Di Bella 
16d8fad661SChristopher Di Bella #include <ranges>
17d8fad661SChristopher Di Bella 
18d8fad661SChristopher Di Bella #include "test_range.h"
19d8fad661SChristopher Di Bella 
20d8fad661SChristopher Di Bella namespace stdr = std::ranges;
21d8fad661SChristopher Di Bella 
22d8fad661SChristopher Di Bella template <template <class...> class I>
23d8fad661SChristopher Di Bella constexpr bool check_bidirectional_range() {
24d8fad661SChristopher Di Bella   constexpr bool result = stdr::bidirectional_range<test_range<I> >;
25d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_range<I> const> == result);
26d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_non_const_common_range<I> > == result);
27d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_non_const_range<I> > == result);
28d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_common_range<I> > == result);
29d8fad661SChristopher Di Bella   static_assert(stdr::bidirectional_range<test_common_range<I> const> == result);
30d8fad661SChristopher Di Bella   static_assert(!stdr::bidirectional_range<test_non_const_common_range<I> const>);
31d8fad661SChristopher Di Bella   static_assert(!stdr::bidirectional_range<test_non_const_range<I> const>);
32d8fad661SChristopher Di Bella   return result;
33d8fad661SChristopher Di Bella }
34d8fad661SChristopher Di Bella 
35d8fad661SChristopher Di Bella static_assert(!check_bidirectional_range<cpp17_input_iterator>());
36d8fad661SChristopher Di Bella static_assert(!check_bidirectional_range<cpp20_input_iterator>());
37d8fad661SChristopher Di Bella static_assert(!check_bidirectional_range<forward_iterator>());
38d8fad661SChristopher Di Bella static_assert(check_bidirectional_range<bidirectional_iterator>());
39d8fad661SChristopher Di Bella static_assert(check_bidirectional_range<random_access_iterator>());
40d8fad661SChristopher Di Bella static_assert(check_bidirectional_range<contiguous_iterator>());
41