From: François Dumont Date: Wed, 7 Dec 2016 21:16:24 +0000 (+0000) Subject: 2016-12-07 François Dumont X-Git-Tag: upstream/12.2.0~42641 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=352f824f094c380befd7755a331defda5f1edf7f;p=platform%2Fupstream%2Fgcc.git 2016-12-07 François Dumont * include/bits/stl_tree.h (_Rb_tree<>::_M_copy(_Const_Link_type, _Base_ptr)): Delete. (_Rb_tree<>::_M_copy(const _Rb_tree&, _NodeGen&)): New. (_Rb_tree<>::_M_copy(const _Rb_tree&)): New, use latter. (_Rb_tree<>(const _Rb_tree&): Use latter. (_Rb_tree<>(const _Rb_tree&, const allocator_type&)): Likewise. (_Rb_tree<>::_M_move_data(_Rb_tree&, false_type)): Likewise. (_Rb_tree<>::_M_move_assign(_Rb_tree&, false_type)): Likewise. (_Rb_tree<>::operator=(const _Rb_tree&)): Likewise. From-SVN: r243380 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3feef85..085b95a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,15 @@ 2016-12-07 François Dumont + * include/bits/stl_tree.h + (_Rb_tree<>::_M_copy(_Const_Link_type, _Base_ptr)): Delete. + (_Rb_tree<>::_M_copy(const _Rb_tree&, _NodeGen&)): New. + (_Rb_tree<>::_M_copy(const _Rb_tree&)): New, use latter. + (_Rb_tree<>(const _Rb_tree&): Use latter. + (_Rb_tree<>(const _Rb_tree&, const allocator_type&)): Likewise. + (_Rb_tree<>::_M_move_data(_Rb_tree&, false_type)): Likewise. + (_Rb_tree<>::_M_move_assign(_Rb_tree&, false_type)): Likewise. + (_Rb_tree<>::operator=(const _Rb_tree&)): Likewise. + * include/bits/stl_map.h (map(const map&)): Make default. (map(map&&)): Likewise. (~map()): Likewise. diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index f5bb5f7..86d26d5 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -861,11 +861,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Link_type _M_copy(_Const_Link_type __x, _Base_ptr __p, _NodeGen&); + template + _Link_type + _M_copy(const _Rb_tree& __x, _NodeGen& __gen) + { + _Link_type __root = _M_copy(__x._M_begin(), _M_end(), __gen); + _M_leftmost() = _S_minimum(__root); + _M_rightmost() = _S_maximum(__root); + _M_impl._M_node_count = __x._M_impl._M_node_count; + return __root; + } + _Link_type - _M_copy(_Const_Link_type __x, _Base_ptr __p) + _M_copy(const _Rb_tree& __x) { _Alloc_node __an(*this); - return _M_copy(__x, __p, __an); + return _M_copy(__x, __an); } void @@ -903,12 +914,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_impl(__x._M_impl) { if (__x._M_root() != 0) - { - _M_root() = _M_copy(__x._M_begin(), _M_end()); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - } + _M_root() = _M_copy(__x); } #if __cplusplus >= 201103L @@ -920,12 +926,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_impl(__x._M_impl._M_key_compare, _Node_allocator(__a)) { if (__x._M_root() != nullptr) - { - _M_root() = _M_copy(__x._M_begin(), _M_end()); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - } + _M_root() = _M_copy(__x); } _Rb_tree(_Rb_tree&&) = default; @@ -1595,10 +1596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION auto& __val = const_cast(__cval); return __an(std::move_if_noexcept(__val)); }; - _M_root() = _M_copy(__x._M_begin(), _M_end(), __lbd); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; + _M_root() = _M_copy(__x, __lbd); } } @@ -1636,10 +1634,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION auto& __val = const_cast(__cval); return __roan(std::move_if_noexcept(__val)); }; - _M_root() = _M_copy(__x._M_begin(), _M_end(), __lbd); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; + _M_root() = _M_copy(__x, __lbd); __x.clear(); } } @@ -1653,10 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION && is_nothrow_move_assignable<_Compare>::value) { _M_impl._M_key_compare = std::move(__x._M_impl._M_key_compare); - constexpr bool __move_storage = - _Alloc_traits::_S_propagate_on_move_assign() - || _Alloc_traits::_S_always_equal(); - _M_move_assign(__x, __bool_constant<__move_storage>()); + _M_move_assign(__x, __bool_constant<_Alloc_traits::_S_nothrow_move()>()); return *this; } @@ -1716,12 +1708,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_impl._M_reset(); _M_impl._M_key_compare = __x._M_impl._M_key_compare; if (__x._M_root() != 0) - { - _M_root() = _M_copy(__x._M_begin(), _M_end(), __roan); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - } + _M_root() = _M_copy(__x, __roan); } return *this;