[libcxx-commits] [libcxx] [libc++] P3168R2 Give std::optional Range Support (PR #146491)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 2 02:46:06 PDT 2025


================
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+// 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: std-at-least-c++26
+
+#include <optional>
+#include <ranges>
+
+int main() {
+  static_assert(std::ranges::range<std::optional<int>>);
----------------
frederick-vs-ja wrote:

Ditto `.compile.pass.cpp`. I think we want to `static_assert` `sized_range`, `common_range`, and `contiguous_range`.

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


More information about the libcxx-commits mailing list