[libcxx-commits] [libcxx] [libc++] P3168R2 Give std::optional Range Support (PR #146491)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 1 04:19:35 PDT 2025
================
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 <iostream>
+#include <optional>
+
+int main() {
+ std::optional<int> val = 2;
+ for (const auto& elem : val) {
+ std::cout << elem << std::endl;
----------------
frederick-vs-ja wrote:
We should `assert` here.
Also, there should be a file testing the properties of the iterator types.
https://github.com/llvm/llvm-project/pull/146491
More information about the libcxx-commits
mailing list