|
2 | 2 | // Distributed under the Boost Software License, Version 1.0. |
3 | 3 | // https://www.boost.org/LICENSE_1_0.txt |
4 | 4 |
|
5 | | -#include <boost/multi/array.hpp> |
| 5 | +#include <boost/multi/array.hpp> // IWYU pragma: keep |
6 | 6 |
|
7 | 7 | #include <boost/core/lightweight_test.hpp> |
8 | 8 |
|
|
16 | 16 | #include <ranges> // IWYU pragma: keep |
17 | 17 | #endif |
18 | 18 |
|
19 | | -namespace multi = boost::multi; |
| 19 | +namespace multi = boost::multi; // NOLINT(misc-unused-alias-decls) |
20 | 20 |
|
21 | 21 | auto main() -> int { // NOLINT(bugprone-exception-escape) |
22 | 22 | #if defined(__cpp_lib_ranges_zip) and (__cpp_lib_ranges_zip >= 202110L) |
@@ -56,6 +56,31 @@ auto main() -> int { // NOLINT(bugprone-exception-escape) |
56 | 56 | BOOST_TEST( e1 == 5 ); |
57 | 57 | BOOST_TEST( e2 == 6 ); |
58 | 58 | } |
| 59 | + { |
| 60 | + multi::array<int, 1> arr1({10}, 5); |
| 61 | + multi::array<int, 1> arr2({10}, 6); |
| 62 | + |
| 63 | + auto zp = std::views::zip(arr1(), arr2()); |
| 64 | + |
| 65 | + auto [e1, e2] = zp[3]; |
| 66 | + |
| 67 | + BOOST_TEST( e1 == 5 ); |
| 68 | + BOOST_TEST( e2 == 6 ); |
| 69 | + } |
| 70 | + { |
| 71 | + multi::array<int, 1> arr1({10}, 5); |
| 72 | + multi::array<int, 1> arr2({10}, 6); |
| 73 | + |
| 74 | + auto es1 = arr1().elements(); |
| 75 | + auto es2 = arr2().elements(); |
| 76 | + |
| 77 | + auto zp = std::views::zip(arr1, arr2); |
| 78 | + |
| 79 | + auto [e1, e2] = zp[3]; |
| 80 | + |
| 81 | + BOOST_TEST( e1 == 5 ); |
| 82 | + BOOST_TEST( e2 == 6 ); |
| 83 | + } |
59 | 84 | #endif |
60 | 85 |
|
61 | 86 | return boost::report_errors(); |
|
0 commit comments