[libcxx-commits] [libcxx] 617646a - [libc++] Use __alloc_traits in <deque> whenever it is available for consistency (#126595)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 19 09:23:39 PDT 2025
Author: Peng Liu
Date: 2025-03-19T12:23:35-04:00
New Revision: 617646ab8d148ab51e8b94ccc0a40af2fc6c3dcf
URL: https://github.com/llvm/llvm-project/commit/617646ab8d148ab51e8b94ccc0a40af2fc6c3dcf
DIFF: https://github.com/llvm/llvm-project/commit/617646ab8d148ab51e8b94ccc0a40af2fc6c3dcf.diff
LOG: [libc++] Use __alloc_traits in <deque> whenever it is available for consistency (#126595)
When an allocator-aware container already defines a member type alias
`__alloc_traits` for `std::allocator_traits<allocator_type>`, we should
consistently use `__alloc_traits`. Mixing the usage of both
`__alloc_traits` and `std::allocator_traits` can lead to inconsistencies
and confusion.
Added:
Modified:
libcxx/include/deque
Removed:
################################################################################
diff --git a/libcxx/include/deque b/libcxx/include/deque
index 95200b4801d7f..04788c277e428 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -59,7 +59,7 @@ public:
deque& operator=(const deque& c);
deque& operator=(deque&& c)
- noexcept((__alloc_traits::propagate_on_container_move_assignment::value &&
+ noexcept((allocator_traits<allocator_type>::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
allocator_traits<allocator_type>::is_always_equal::value);
deque& operator=(initializer_list<value_type> il);
@@ -677,7 +677,7 @@ public:
_LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c) noexcept(
(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
- allocator_traits<allocator_type>::is_always_equal::value);
+ __alloc_traits::is_always_equal::value);
_LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
# endif // _LIBCPP_CXX03_LANG
@@ -1382,7 +1382,7 @@ template <class _Tp, class _Allocator>
inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) noexcept(
(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
- allocator_traits<allocator_type>::is_always_equal::value) {
+ __alloc_traits::is_always_equal::value) {
__move_assign(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
More information about the libcxx-commits
mailing list