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 auto end() |
12 | // requires (!simple-view<V>) |
13 | // constexpr auto end() const |
14 | // requires range<const V> |
15 | |
16 | #include <ranges> |
17 | |
18 | #include "test_macros.h" |
19 | #include "types.h" |
20 | |
21 | constexpr bool test() { |
22 | // range<const V> |
23 | std::ranges::drop_view dropView1(MoveOnlyView(), 4); |
24 | assert(dropView1.end() == globalBuff + 8); |
25 | |
26 | // !simple-view<V> |
27 | std::ranges::drop_view dropView2(InputView(), 4); |
28 | assert(dropView2.end() == globalBuff + 8); |
29 | |
30 | // range<const V> |
31 | const std::ranges::drop_view dropView3(MoveOnlyView(), 0); |
32 | assert(dropView3.end() == globalBuff + 8); |
33 | |
34 | // !simple-view<V> |
35 | const std::ranges::drop_view dropView4(InputView(), 2); |
36 | assert(dropView4.end() == globalBuff + 8); |
37 | |
38 | // range<const V> |
39 | std::ranges::drop_view dropView5(MoveOnlyView(), 10); |
40 | assert(dropView5.end() == globalBuff + 8); |
41 | |
42 | return true; |
43 | } |
44 | |
45 | int main(int, char**) { |
46 | test(); |
47 | static_assert(test()); |
48 | |
49 | return 0; |
50 | } |
51 | |