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

Will Hawkins via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 29 06:41:29 PST 2023


================
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "test.h"
+#include <concepts>
+#include <ranges>
+#include <utility>
+
+constexpr bool test() {
+  int arr[]{1, 2, 3};
+
+  MovedCopiedTrackedBasicView<int> bv{arr, arr + 3};
+  InstrumentedBasicRange<int> br{};
+
+  static_assert(std::same_as< decltype(std::ranges::stride_view(bv, 2)), std::ranges::stride_view<decltype(bv)> >);
+  static_assert(
+      std::same_as< decltype(std::ranges::stride_view(std::move(bv), 2)), std::ranges::stride_view<decltype(bv)> >);
+
+  static_assert(std::same_as< decltype(std::ranges::drop_view(br, 0)),
----------------
hawkinsw wrote:

I believe that this is addressed in ea08810a0c8230b0b55076ba33cc870a512453d7.

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


More information about the libcxx-commits mailing list