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, c++20 |
10 | |
11 | // constexpr iterator& operator++(); |
12 | // constexpr void operator++(int); |
13 | |
14 | #include <ranges> |
15 | #include <concepts> |
16 | #include <cassert> |
17 | |
18 | constexpr bool test() { |
19 | using Iter = std::ranges::iterator_t<std::ranges::repeat_view<int>>; |
20 | std::ranges::repeat_view<int> rv(10); |
21 | using Iter = std::ranges::iterator_t<std::ranges::repeat_view<int>>; |
22 | auto iter = rv.begin(); |
23 | |
24 | assert(iter++ == rv.begin()); |
25 | assert(++iter == rv.begin() + 2); |
26 | |
27 | static_assert(std::same_as<decltype(iter++), Iter>); |
28 | static_assert(std::same_as<decltype(++iter), Iter&>); |
29 | |
30 | return true; |
31 | } |
32 | |
33 | int main(int, char**) { |
34 | test(); |
35 | static_assert(test()); |
36 | |
37 | return 0; |
38 | } |
39 | |