[libcxx-commits] [libcxx] [libc++] Partially implement P2846R6: `reserve_hint` (PR #206385)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 30 04:11:06 PDT 2026
================
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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++26
+
+// std::ranges::reserve_hint
+
+#include <ranges>
+
+extern int arr[];
+
+// Verify that for an array of unknown bound `ranges::reserve_hint` is ill-formed.
+void test() {
+ std::ranges::reserve_hint(arr);
----------------
frederick-vs-ja wrote:
This seems to be resolved. We can use `requires { std::ranges::reserve_hint(std::declval<T>()); }`, but `is_invocable_v` and `is_nothrow_invocable_v` seem working.
https://github.com/llvm/llvm-project/pull/206385
More information about the libcxx-commits
mailing list