[libcxx-commits] [libcxx] [libc++][ranges] Implement `ranges::stride_view`. (PR #65200)

Will Hawkins via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 11 07:24:41 PST 2023


================
@@ -0,0 +1,133 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// ranges
+
+// std::views::stride_view
+
+#include "__ranges/stride_view.h"
+#include "test.h"
+#include "test_iterators.h"
+#include <concepts>
+#include <iterator>
+#include <ranges>
+#include <utility>
+
+template <class View, class T>
+concept CanBePiped = requires(View&& view, T&& t) {
+  { std::forward<View>(view) | std::forward<T>(t) };
+};
+
+constexpr bool test() {
+  constexpr int array_n = 3;
+  int arr[array_n]      = {1, 2, 3};
+
+  // Test that `std::views::stride` is a range adaptor.
+  { // Check various forms of
+    // view | stride
+    {
----------------
hawkinsw wrote:

I believe that this is addressed in a96dd45cbad8b7c0d6e6a2e3fa008471be88ef12.

https://github.com/llvm/llvm-project/pull/65200


More information about the libcxx-commits mailing list