Skip to content

Conversation

philnik777
Copy link
Contributor

__swap_allocator does this automatically when not providing it explicitly, so this is just more code without any benefit.

@philnik777 philnik777 marked this pull request as ready for review August 26, 2024 16:44
@philnik777 philnik777 requested a review from a team as a code owner August 26, 2024 16:44
@philnik777 philnik777 merged commit 7106643 into llvm:main Aug 26, 2024
57 checks passed
@philnik777 philnik777 deleted the use_public_swap branch August 26, 2024 16:44
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 26, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 26, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

__swap_allocator does this automatically when not providing it explicitly, so this is just more code without any benefit.


Full diff: https://github.com/llvm/llvm-project/pull/105980.diff

2 Files Affected:

  • (modified) libcxx/include/forward_list (+1-2)
  • (modified) libcxx/include/vector (+2-4)
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index b14d2cb6c78036..b8e3d05588f96e 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -620,8 +620,7 @@ inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
     _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)
 #endif
 {
-  std::__swap_allocator(
-      __alloc(), __x.__alloc(), integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
+  std::__swap_allocator(__alloc(), __x.__alloc());
   using std::swap;
   swap(__before_begin()->__next_, __x.__before_begin()->__next_);
 }
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 3aa23d8fc1e243..a858f458f44308 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -1821,8 +1821,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x)
   std::swap(this->__begin_, __x.__begin_);
   std::swap(this->__end_, __x.__end_);
   std::swap(this->__end_cap(), __x.__end_cap());
-  std::__swap_allocator(
-      this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
+  std::__swap_allocator(this->__alloc(), __x.__alloc());
 }
 
 template <class _Tp, class _Allocator>
@@ -2820,8 +2819,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::swap(vector& __x)
   std::swap(this->__begin_, __x.__begin_);
   std::swap(this->__size_, __x.__size_);
   std::swap(this->__cap(), __x.__cap());
-  std::__swap_allocator(
-      this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
+  std::__swap_allocator(this->__alloc(), __x.__alloc());
 }
 
 template <class _Allocator>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants