[libcxx-commits] [PATCH] D137739: [libc++] Implement P0339R6 (polymorphic_allocator<> as a vocabulary type)

Lewis Fox via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 28 22:29:54 PST 2022


LRFLEW added a comment.

The implementation of `polymorphic_allocator::allocate_object` here doesn't follow the changes in LWG 3237 <https://cplusplus.github.io/LWG/issue3237> and LWG 3310 <https://cplusplus.github.io/LWG/issue3310>. `SIZE_MAX` should be replaced with `numeric_limits<size_t>::max()` (perhaps using a templated version of `__max_size()`), and the error condition should throw `bad_array_new_length` instead of `length_error`.

Also, on the topic of LWG 3304, it looks like `polymorphic_allocator::allocate` is supposed to be marked as `[[nodiscard]]` in C++20. Would it make sense for this patch to also include that change as well?

Lastly, I noticed that the existing code is using `#if _LIBCPP_STD_VER > 14`, but the code added here is using `#if _LIBCPP_STD_VER >= 20`. Would it make more sense to use `#if _LIBCPP_STD_VER > 17` instead?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137739/new/

https://reviews.llvm.org/D137739



More information about the libcxx-commits mailing list