[libcxx-commits] [libcxx] [libcxx] Align `__recommend() + 1` by __endian_factor (PR #90292)
Vitaly Buka via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 2 11:25:38 PDT 2024
vitalybuka wrote:
> > > _LIBCPP_ASSERT_INTERNAL
> >
> >
> > Done, but I am curious why this can be wrong? Seems set/get should return exactly the same value.
>
> As I tried to explain before, `__allocate_at_least` may return more bytes than we requested with a custom allocator - possibly (even though unlikely) an odd number of elements. Since we drop the last bit of our capacity, we have no choice but to drop the last element of that allocation.
Hm, then as-is custom allocator can return more, but if allocator needs correct value for __alloc_traits::deallocate, `allocate` suppose to return size magically aligned.
https://github.com/llvm/llvm-project/pull/90292
More information about the libcxx-commits
mailing list