[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:09:35 PDT 2026


================
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 <cassert>
+#include <ranges>
----------------
frederick-vs-ja wrote:

```suggestion
#include <cassert>
#include <cstddef>
#include <ranges>
#include <type_traits>
```

I think we shouldn't rely on transitive inclusion. For `std::size_t` we generally include `<cstddef>`, for `is_invocable_v` we should include `<type_traits>`. It's critical for Clang module builds to properly include corresponding headers.

Same for other test files.

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


More information about the libcxx-commits mailing list