[PATCH] Cleanup std::inplace_vector implementation
Jonathan Wakely
jwakely@redhat.com
Mon Sep 22 18:04:05 GMT 2025
On Mon, 22 Sept 2025 at 18:15, François Dumont <frs.dumont@gmail.com> wrote:
>
> Some minor points spotted while working on the _GLIBCXX_DEBUG
> implementation.
>
> I'm surprised that gcc did not complained about the duplicated std::swap
> implementation. He seems to be smart enough to see that it is the same
> despite the different noexcept qualification.
No, they're not the same. The friend one is a non-template function
which is defined for every std::inplace_vector specialization, and the
one at namespace scope is a function template.
It's still correct to remove the one at namespace scope, but GCC is
right to not complain.
> libstdc++: std::inplace_vector implementation cleaup
>
> Remove duplicated std::swap implementations.
>
> Remove use of std::ref in std::erase_if.
>
> libstdc++-v3/ChangeLog
>
> * include/std/inplace_vector: Remove refwrap.h include.
> (std::swap(inplace_vector<>&, inplace_vector<>&)): Remove
> the duplicated
> implementation at std namespace level. Keep the friend
> inline one.
> (std::erase_if): Remove std::ref usage.
>
> 23_containers/inplace_vector tests run under Linux x86_64.
>
> Ok to commit ?
No, I'm already changing erase_if and erase in
https://forge.sourceware.org/gcc/gcc-TEST/pulls/78/commits/4d4a7dd885afca17a526caf504463310b3159587
which I'm about to push.
More information about the Libstdc++
mailing list