Skip to content

Commit 7106643

Browse files
authored
[libc++][NFC] Don't explicitly provide propagate_on_container_swap when calling __swap_allocator (#105980)
`__swap_allocator` does this automatically when not providing it explicitly, so this is just more code without any benefit.
1 parent 2e426fe commit 7106643

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

libcxx/include/forward_list

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,7 @@ inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
620620
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)
621621
#endif
622622
{
623-
std::__swap_allocator(
624-
__alloc(), __x.__alloc(), integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
623+
std::__swap_allocator(__alloc(), __x.__alloc());
625624
using std::swap;
626625
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
627626
}

libcxx/include/vector

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,8 +1821,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x)
18211821
std::swap(this->__begin_, __x.__begin_);
18221822
std::swap(this->__end_, __x.__end_);
18231823
std::swap(this->__end_cap(), __x.__end_cap());
1824-
std::__swap_allocator(
1825-
this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
1824+
std::__swap_allocator(this->__alloc(), __x.__alloc());
18261825
}
18271826

18281827
template <class _Tp, class _Allocator>
@@ -2820,8 +2819,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::swap(vector& __x)
28202819
std::swap(this->__begin_, __x.__begin_);
28212820
std::swap(this->__size_, __x.__size_);
28222821
std::swap(this->__cap(), __x.__cap());
2823-
std::__swap_allocator(
2824-
this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
2822+
std::__swap_allocator(this->__alloc(), __x.__alloc());
28252823
}
28262824

28272825
template <class _Allocator>

0 commit comments

Comments
 (0)