[libcxx-commits] [libcxx] [libc++][ranges] Applied [[nodiscard]] to `join_view` (PR #206838)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 6 16:50:02 PDT 2026
================
@@ -0,0 +1,73 @@
+
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++20
+
+// Test the libc++ extension that std::ranges::join_view and std::views::view are marked as [[nodiscard]].
+
+#include <functional>
+#include <ranges>
+#include <string>
+#include <utility>
+#include <vector>
+
+struct InnerView : std::ranges::view_interface<InnerView> {
+ int* begin();
+ const int* begin() const;
+ volatile int* end();
+ const volatile int* end() const;
+};
+
+struct View : std::ranges::view_interface<View> {
+ InnerView* begin();
+ const InnerView* begin() const;
+ volatile InnerView* end();
+ const volatile InnerView* end() const;
+};
----------------
frederick-vs-ja wrote:
I think it was me that suggested such views. IMO it's already simple enough as a non-simple, non-common range.
https://github.com/llvm/llvm-project/pull/206838
More information about the libcxx-commits
mailing list