[libcxx-commits] [libcxx] [libc++] Partially implement P2846R6: `reserve_hint` (PR #206385)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 6 02:02:14 PDT 2026
================
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// constexpr auto reserve_hint()
+// requires approximately_sized_range<R>
+// constexpr auto reserve_hint() const
+// requires approximately_sized_range<const R>
+
+#include <array>
+#include <cassert>
+#include <concepts>
+#include <ranges>
+#include <utility>
+
+#include "test_iterators.h"
+
+int globalBuff[8];
+
+template <class T>
+concept HasReserveHint = requires(T t) { t.reserve_hint(); };
----------------
Zingam wrote:
Just a suggestion (not necessarily a change request): Can you use this name consistently. This naming scheme is the most common in the ranges test suite. I think you have redeclared this with different names a few times. Maybe make this concept global once.
https://github.com/llvm/llvm-project/pull/206385
More information about the libcxx-commits
mailing list