Default associative containers constructors/destructor/assignment
François Dumont
frs.dumont@gmail.com
Fri Oct 28 19:43:00 GMT 2016
Hi
Here is the patch to default all other associative containers
operations that can be defaulted.
To do so I introduce a _Rb_tree_key_compare type that take care of
value initialization of compare functor. It also make sure that functor
is copied rather than move in move constructor with necessary noexcept
qualification.
I also introduce _Rb_tree_header to take care of the initialization
of the _Rb_tree_node_base used in the container header and of
_M_node_count. I also use it to implement the move semantic and so
default also _Rb_tree_impl move construtor.
I also propose a solution for the FIXME regarding documentation of
container destructor, I used C++11 default declaration. I don't have
necessary tools to generate Doxygen doc but I am confident that it
should work fine. I had to simplify doc for operations that are now
defaulted.
* include/bits/stl_map.h (map(const map&)): Make default.
(map(map&&)): Likewise.
(~map()): Likewise.
(operator=(const map&)): Likewise.
* include/bits/stl_multimap.h (multimap(const multimap&)): Make
default.
(multimap(multimap&&)): Likewise.
(~multimap()): Likewise.
(operator=(const multimap&)): Likewise.
* include/bits/stl_set.h (set(const set&)): Make default.
(set(set&&)): Likewise.
(~set()): Likewise.
(operator=(const set&)): Likewise.
* include/bits/stl_multiset.h (multiset(const multiset&)): Make
default.
(multiset(multiset&&)): Likewise.
(~multiset()): Likewise.
(operator=(const multiset&)): Likewise.
* include/bits/stl_tree.h (_Rb_tree_key_compare<>): New.
(_Rb_tree_header): New.
(_Rb_tree_impl): Inherit from latter.
(_Rb_tree_impl()): Make default.
(_Rb_tree_impl(const _Rb_tree_impl&)): New.
(_Rb_tree_impl(_Rb_tree_impl&&)): New, default.
(_Rb_tree_impl::_M_reset): Move...
(_Rb_tree_header::_M_reset): ...here.
(_Rb_tree_impl::_M_initialize): Move...
(_Rb_tree_header::_M_initialize): ...here.
(_Rb_tree(_Rb_tree&&)): Make default.
(_Rb_tree_header::_M_move_data(_Rb_tree_header&)): New.
(_Rb_tree<>::_M_move_data(_Rb_tree&, true_type)): Use latter.
Tested under Linux x86_64, ok to commit ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: default_tree.patch
Type: text/x-patch
Size: 16559 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20161028/8d88f434/attachment.bin>
More information about the Libstdc++
mailing list