[libcxx-commits] [libcxx] [libc++] Use __alloc_traits whenever it is available for consistency (PR #126595)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 12 06:03:37 PST 2025
winner245 wrote:
> These changes are modifying stuff that was 1:1 standardese I think, so I'm not sure this change leads to any less "confusion".
For deque, we were mixing `__alloc_traits` and `allocator_traits<allocator_type>` in the same code block in several cases, which is a clear inconsistency. Since we've already defined the member type `__alloc_traits`, I believe consistently using `__alloc_traits` would reduce confusion.
For list and forward_list, we were mixing `__node_alloc_traits` (list) or `__node_traits` (forward_list) with `allocator_traits<allocator_type>`, which implicitly assumes that rebound allocator traits and `allocator_traits<allocator_type>` have the same properties. Once [LWG3267](https://cplusplus.github.io/LWG/issue3267) is fixed, I believe fixing the inconsistency here would reduce confusion. However, for now I do not want to get into these subtilties due to the implicit assumption made in our implementation. Therefore, I've reverted the changes for list and forward_list.
https://github.com/llvm/llvm-project/pull/126595
More information about the libcxx-commits
mailing list