[libcxx-commits] [libcxx] [libc++][ranges] Applied `[[nodiscard]]` to `view_interface` (PR #174360)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jan 4 22:29:44 PST 2026
================
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// Check that functions are marked [[nodiscard]]
+
+#include <cstddef>
+#include <ranges>
+#include <utility>
+
+struct View : std::ranges::view_interface<View> {
+ int* begin() noexcept;
+ int* end() noexcept;
+ const int* begin() const noexcept;
+ const int* end() const noexcept;
+};
+
+template <>
+inline constexpr bool std::ranges::enable_view<View> = true;
+
----------------
frederick-vs-ja wrote:
This specialization is redundant. [Godbolt link](https://godbolt.org/z/91PPjx71x).
https://github.com/llvm/llvm-project/pull/174360
More information about the libcxx-commits
mailing list