This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Forward list default default and move constructors


Hello

    Any feedback regarding this patch ?

Thanks,
François

On 19/06/2017 22:48, François Dumont wrote:
Hi

Here is the patch to default the default and move constructors on the std::forward_list. Putting a move constructor on _Fwd_list_node_base helped limiting the code impact of this patch. It doesn't have any side effect as iterator types using this base type are not defining any move semantic.

I also took the time to optimize the move constructor with allocator when allocator is always equal. It avoids initializing an empty forward list for nothing.

I think it is fine but could we have an abi issue because of the change in forward_list.tcc ?

    * include/bits/forward_list.h
    (_Fwd_list_node_base(_Fwd_list_node_base&&)): New.
    (_Fwd_list_impl()): Add noexcept qualification.
    (_Fwd_list_impl(_Fwd_list_impl&&)): New, default.
    (_Fwd_list_impl(_Fwd_list_impl&&, _Node_alloc_type&&)): New.
    (_Fwd_list_base()): Default.
(_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&, true_type)): New. (_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&, false_type)): New.
    (_Fwd_list_base(_Fwd_list_base&& __lst, _Node_alloc_type&& __a)): Use
    latter.
    (_Fwd_list_base(_Fwd_list_base&&)): Default.
    (forward_list<>()): Default.
    (forward_list<>(forward_list&&)): Default.
    * include/bits/forward_list.tcc
(_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&, false_type)): New. * testsuite/23_containers/forward_list/allocator/default_init.cc: New.

Tested under Linux x86_64, ok to commit ?

François



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]