Default std::list default and move constructors

François Dumont frs.dumont@gmail.com
Mon Jun 26 19:29:00 GMT 2017


Hi

     Here is the patch to default implementation of std::list default 
and move constructors.

     I introduce _List_node_header to take care of the move 
implementation and also isolate management of the optional list size 
storage. I prefer it to usage of _List_node<size_t> as move constructor 
seems complicated to implement with an __aligned_membuf. It also avoids 
to use raw memory as-if it was a size_t without constructing it. Even if 
size_t constructor is trivial I guess some memory analyser could have 
complain about it.

     * include/bits/stl_list.h
     (_List_node_base()): Define.
     (_List_node_base(_List_node_base*, _List_node_base*)): New.
     (struct _List_node_header): New.
     (_List_impl()): Fix noexcept qualification.
     (_List_impl(_List_impl&&)): New, default.
     (_List_impl(_List_impl&&, _Node_alloc_type&&)): New.
     (_List_base()): Default.
     (_List_base(_List_base&&)): Default.
     (_List_base(_List_base&&, _Node_alloc_type&&, true_type)): New.
     (_List_base(_List_base&&, _Node_alloc_type&&, false_type)): New.
     (_List_base(_List_base&&, _Node_alloc_type&&)): Use latters.
     (_List_base::_M_move_nodes): Adapt to use
     _List_node_header._M_move_nodes.
     (_List_base::_M_init): Likewise.
     (list<>()): Default.
     (list<>(list&&)): Default.
     (list<>::_M_move_assign(list&&, true_type)): Use _M_move_nodes.

     Tested under Linux x86_64.

Ok to commit ?

François


-------------- next part --------------
A non-text attachment was scrubbed...
Name: list.patch
Type: text/x-patch
Size: 12084 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20170626/5d0511fe/attachment.bin>


More information about the Libstdc++ mailing list