[libcxx-commits] [libcxx] [libc++][ranges] Implement `ranges::stride_view`. (PR #65200)
Will Hawkins via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 2 19:23:49 PST 2024
================
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+// UNSUPPORTED: no-exceptions
+// UNSUPPORTED: libcpp-hardening-mode=none
+// XFAIL: availability-verbose_abort-missing
+
+#include "check_assertion.h"
+#include <ranges>
+
+int main(int, char**) {
+ {
+ int range[] = {1, 2, 3};
+ auto striv = std::ranges::views::stride(range, 3);
+ auto striv_it = striv.begin();
+ striv_it++;
+ TEST_LIBCPP_ASSERT_FAILURE(*striv_it, "Cannot dereference an iterator at the end.");
+ }
+ {
+ int range[] = {1, 2, 3};
+ auto striv = std::ranges::views::stride(range, 4);
+ auto striv_it = striv.begin();
+ striv_it++;
----------------
hawkinsw wrote:
Thanks! (3112b3d058c63568ce03a7fa5f3537124a40d7c4)
https://github.com/llvm/llvm-project/pull/65200
More information about the libcxx-commits
mailing list