[libcxx-commits] [libcxx] [libc++] Refactor basic_string::__recommend (PR #162631)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 10 10:02:44 PDT 2025
================
@@ -2246,7 +2246,9 @@ private:
// Allocate a buffer of __capacity size with __alloc and return it
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __long
__allocate_long_buffer(_Allocator& __alloc, size_type __capacity) {
- auto __buffer = std::__allocate_at_least(__alloc, __recommend(__capacity) + 1);
+ _LIBCPP_ASSERT_INTERNAL(
+ !__fits_in_sso(__capacity), "Trying to allocate long buffer which fits into the small buffer");
----------------
ldionne wrote:
```suggestion
!__fits_in_sso(__capacity), "Trying to allocate long buffer for a capacity that would fit in the small buffer");
```
https://github.com/llvm/llvm-project/pull/162631
More information about the libcxx-commits
mailing list