[PATCH] Fix _GLIBCXX_DEBUG container allocator aware move constructors
Jonathan Wakely
jwakely@redhat.com
Sat Mar 27 21:07:44 GMT 2021
On 26/03/21 21:41 +0100, François Dumont via Libstdc++ wrote:
>I review the allocator aware move constructors of _GLIBCXX_DEBUG containers.
>
>I think the recently added __gnu_debug basic_string one is also
>missing the rvalue reference, no ?
You mean is_nothrow_constructible<Base, Base&&, const Alloc&> instead
of is_nothrow_constructible<Base,Base, const Alloc&>?
No, it's not missing. They mean the exact same thing: Base is an
rvalue, Base&& is an rvalue, and Base& is an lvalue. Writing Base&&
instead of Base is just extra noise that adds no value.
> libstdc++: _GLIBCXX_DEBUG Fix allocator aware move constructor
The correct term is "allocator-extended move constructor". And is it
really a "fix"? The standard doesn't require a noexcept-specifier on
those constructors, so what we have now is not incorrect, just
suboptimal.
> Fix several allocator aware move construtor in _GLIBCXX_DEBUG
> containers.
>
> libstdc++-v3/ChangeLog:
> * include/debug/forward_list
> (forward_list(forward_list&&, const allocator_type&)): Add
>noexcept qualification.
> * include/debug/list (list(list&&, const
>allocator_type&)): Likewise and add
> call to safe container allocator aware move constructor.
> * include/debug/string (basic_string(basic_string&&, const
>_Allocator&)):
> Check base type allocator aware more constructor.
> * include/debug/vector (vector(vector&&, const
>allocator_type&)):
> Fix noexcept qualification.
> *
>testsuite/23_containers/forward_list/cons/noexcept_move_construct.cc:
> Add allocator aware move constructor noexceot
>qualification check.
> *
>testsuite/23_containers/list/cons/noexcept_move_construct.cc:
>Likewise.
>
>Tested under linux x86_64.
>
>Ok to commit ?
OK, thanks.
More information about the Libstdc++
mailing list