Default associative containers constructors/destructor/assignment
François Dumont
frs.dumont@gmail.com
Mon Nov 14 20:35:00 GMT 2016
Any feedback regarding this patch ?
François
On 02/11/2016 22:37, François Dumont wrote:
> Hi
>
> Here is an updated proposal, I realized that the newly introduced
> _M_move_data can be also used in the swap implementation.
>
> Let me know if you prefer without it or not.
>
> François
>
>
> On 28/10/2016 21:42, François Dumont wrote:
>> 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
>>
>
More information about the Libstdc++
mailing list