[gcc r16-4145] libstdc++: std::inplace_vector implementation cleaup

Francois Dumont fdumont@gcc.gnu.org
Tue Sep 30 19:59:51 GMT 2025


https://gcc.gnu.org/g:2f5f3eef1d5796defc37ebb46f7ad44d894c14cf

commit r16-4145-g2f5f3eef1d5796defc37ebb46f7ad44d894c14cf
Author: François Dumont <frs.dumont@gmail.com>
Date:   Mon Sep 22 18:54:46 2025 +0200

    libstdc++: std::inplace_vector implementation cleaup
    
    Remove duplicated std::swap implementation.
    
    libstdc++-v3/ChangeLog
    
            * include/std/inplace_vector:
            (std::swap(inplace_vector<>&, inplace_vector<>&)): Remove the duplicated
            implementation at std namespace level. Keep the friend inline one.
            (inplace_vector<Tp, 0>::assign(initializer_list<>)): Add missing return
            statement.

Diff:
---
 libstdc++-v3/include/std/inplace_vector | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/include/std/inplace_vector b/libstdc++-v3/include/std/inplace_vector
index 91ceace08f5b..7aa6f9d4ab28 100644
--- a/libstdc++-v3/include/std/inplace_vector
+++ b/libstdc++-v3/include/std/inplace_vector
@@ -823,6 +823,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 						      __detail::__synth3way);
       }
 
+      // [inplace.vector.special], specialized algorithms
       constexpr friend void
       swap(inplace_vector& __x, inplace_vector& __y)
       noexcept(is_nothrow_swappable_v<_Tp> && is_nothrow_move_constructible_v<_Tp>)
@@ -907,13 +908,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
     };
 
-  // [inplace.vector.special], specialized algorithms
-  template<typename _Tp, size_t _Nm>
-    constexpr void
-    swap(inplace_vector<_Tp, _Nm>& __x, inplace_vector<_Tp, _Nm>& __y)
-    noexcept(noexcept(__x.swap(__y)))
-    { __x.swap(__y); }
-
   // specialization for zero capacity, that is required to be trivally copyable
   // and empty regardless of _Tp.
   template<typename _Tp>
@@ -992,6 +986,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
 	if (__il.size() != 0)
 	  __throw_bad_alloc();
+	return *this;
       }
 
       template<__any_input_iterator _InputIterator>


More information about the Libstdc++-cvs mailing list