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 #ifndef LIBCXX_TEST_SUPPORT_TEST_RANGE_H
9 #define LIBCXX_TEST_SUPPORT_TEST_RANGE_H
10 
11 #include <iterator>
12 #include <ranges>
13 
14 #include "test_iterators.h"
15 
16 #ifdef _LIBCPP_HAS_NO_RANGES
17 #error "test/suppoort/test_range.h" can only be included in builds supporting ranges
18 #endif
19 
20 struct sentinel {
21   bool operator==(std::input_or_output_iterator auto) const;
22 };
23 
24 // clang-format off
25 template <template <class...> class I = input_iterator>
26 requires std::input_or_output_iterator<I<int*> >
27 struct test_range {
28   I<int*> begin();
29   I<int const*> begin() const;
30   sentinel end();
31   sentinel end() const;
32 };
33 
34 template <template <class...> class I = input_iterator>
35 requires std::input_or_output_iterator<I<int*> >
36 struct test_non_const_range {
37   I<int*> begin();
38   sentinel end();
39 };
40 
41 template <template <class...> class I = input_iterator>
42 requires std::input_or_output_iterator<I<int*> >
43 struct test_common_range {
44   I<int*> begin();
45   I<int const*> begin() const;
46   I<int*> end();
47   I<int const*> end() const;
48 };
49 
50 template <template <class...> class I = input_iterator>
51 requires std::input_or_output_iterator<I<int*> >
52 struct test_non_const_common_range {
53   I<int*> begin();
54   I<int*> end();
55 };
56 
57 // clang-format on
58 
59 #endif // LIBCXX_TEST_SUPPORT_TEST_RANGE_H
60