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 // UNSUPPORTED: libcpp-no-concepts
11 // UNSUPPORTED: libcpp-has-no-incomplete-ranges
12 
13 // constexpr InnerIter operator->() const
14 //   requires has-arrow<InnerIter> && copyable<InnerIter>;
15 
16 #include <cassert>
17 #include <ranges>
18 
19 #include "test_macros.h"
20 #include "../types.h"
21 
22 constexpr bool test() {
23   Box buffer[4][4] = {{{1111}, {2222}, {3333}, {4444}}, {{555}, {666}, {777}, {888}}, {{99}, {1010}, {1111}, {1212}}, {{13}, {14}, {15}, {16}}};
24 
25   {
26     // Copyable input iterator with arrow.
27     ValueView<Box> children[4] = {ValueView(buffer[0]), ValueView(buffer[1]), ValueView(buffer[2]), ValueView(buffer[3])};
28     std::ranges::join_view jv(ValueView<ValueView<Box>>{children});
29     assert(jv.begin()->x == 1111);
30   }
31 
32   {
33     std::ranges::join_view jv(buffer);
34     assert(jv.begin()->x == 1111);
35   }
36 
37   {
38     const std::ranges::join_view jv(buffer);
39     assert(jv.begin()->x == 1111);
40   }
41 
42   return true;
43 }
44 
45 int main(int, char**) {
46   test();
47   static_assert(test());
48 
49   return 0;
50 }
51