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 | |
11 | // constexpr value_type operator*() const; |
12 | // Effects: Equivalent to return {cur_, next_.begin()}; |
13 | |
14 | #include <cassert> |
15 | #include <ranges> |
16 | |
17 | #include "../types.h" |
18 | |
19 | struct Iter : ForwardIterBase<Iter> { |
20 | int i; |
21 | constexpr Iter() = default; |
22 | constexpr Iter(int ii) : i(ii) {} |
23 | }; |
24 | |
25 | constexpr bool test() { |
26 | using SplitView = std::ranges::split_view<std::ranges::subrange<Iter>, std::ranges::subrange<Iter>>; |
27 | using SplitIter = std::ranges::iterator_t<SplitView>; |
28 | |
29 | { |
30 | SplitView sv; |
31 | Iter current{5}; |
32 | std::ranges::subrange next{Iter{6}, Iter{7}}; |
33 | const SplitIter it{sv, current, next}; |
34 | std::same_as<std::ranges::subrange<Iter>> decltype(auto) value = *it; |
35 | assert(value.begin().i == 5); |
36 | assert(value.end().i == 6); |
37 | } |
38 | |
39 | return true; |
40 | } |
41 | |
42 | int main(int, char**) { |
43 | test(); |
44 | static_assert(test()); |
45 | |
46 | return 0; |
47 | } |
48 | |