Skip to content

Commit 617646a

Browse files
authored
[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.
1 parent 99997d7 commit 617646a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libcxx/include/deque

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public:
5959
6060
deque& operator=(const deque& c);
6161
deque& operator=(deque&& c)
62-
noexcept((__alloc_traits::propagate_on_container_move_assignment::value &&
62+
noexcept((allocator_traits<allocator_type>::propagate_on_container_move_assignment::value &&
6363
is_nothrow_move_assignable<allocator_type>::value) ||
6464
allocator_traits<allocator_type>::is_always_equal::value);
6565
deque& operator=(initializer_list<value_type> il);
@@ -677,7 +677,7 @@ public:
677677
_LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c) noexcept(
678678
(__alloc_traits::propagate_on_container_move_assignment::value &&
679679
is_nothrow_move_assignable<allocator_type>::value) ||
680-
allocator_traits<allocator_type>::is_always_equal::value);
680+
__alloc_traits::is_always_equal::value);
681681

682682
_LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
683683
# endif // _LIBCPP_CXX03_LANG
@@ -1382,7 +1382,7 @@ template <class _Tp, class _Allocator>
13821382
inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) noexcept(
13831383
(__alloc_traits::propagate_on_container_move_assignment::value &&
13841384
is_nothrow_move_assignable<allocator_type>::value) ||
1385-
allocator_traits<allocator_type>::is_always_equal::value) {
1385+
__alloc_traits::is_always_equal::value) {
13861386
__move_assign(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
13871387
return *this;
13881388
}

0 commit comments

Comments
 (0)