Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 40 additions & 48 deletions stl/inc/deque
Original file line number Diff line number Diff line change
Expand Up @@ -722,43 +722,37 @@ public:
_Take_contents(_Right);
}

private:
void _Move_assign(deque& _Right, _Equal_allocators) noexcept {
_Tidy();
_Pocma(_Getal(), _Right._Getal());
_Take_contents(_Right);
}

void _Move_assign(deque& _Right, _Propagate_allocators) {
auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
if (_Al == _Right_al) {
_Move_assign(_Right, _Equal_allocators{});
} else {
_Alproxy_ty _Alproxy(_Al);
_Alproxy_ty _Right_alproxy(_Right_al);
_Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{});
_Tidy();
_Pocma(_Al, _Right_al);
_Proxy._Bind(_Alproxy, _STD addressof(_Get_data()));
_Take_contents(_Right);
public:
deque& operator=(deque&& _Right) noexcept(_Alty_traits::is_always_equal::value) {
if (this == _STD addressof(_Right)) {
return *this;
}
}

void _Move_assign(deque& _Right, _No_propagate_allocators) {
if (_Getal() == _Right._Getal()) {
_Move_assign(_Right, _Equal_allocators{});
} else {
assign(
_STD make_move_iterator(_Right._Unchecked_begin()), _STD make_move_iterator(_Right._Unchecked_end()));
auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
constexpr auto _Pocma_val = _Choose_pocma_v<_Alty>;
if constexpr (_Pocma_val == _Pocma_values::_Propagate_allocators) {
if (_Al != _Right_al) {
_Alproxy_ty _Alproxy(_Al);
_Alproxy_ty _Right_alproxy(_Right_al);
_Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{});
_Tidy();
_Pocma(_Al, _Right_al);
_Proxy._Bind(_Alproxy, _STD addressof(_Get_data()));
_Take_contents(_Right);
return *this;
}
} else if constexpr (_Pocma_val == _Pocma_values::_No_propagate_allocators) {
if (_Al != _Right_al) {
assign(_STD make_move_iterator(_Right._Unchecked_begin()),
_STD make_move_iterator(_Right._Unchecked_end()));
return *this;
}
}
}

public:
deque& operator=(deque&& _Right) noexcept(_Alty_traits::is_always_equal::value) {
if (this != _STD addressof(_Right)) {
_Move_assign(_Right, _Choose_pocma<_Alty>{});
}
_Tidy();
_Pocma(_Al, _Right_al);
_Take_contents(_Right);

return *this;
}
Expand Down Expand Up @@ -875,25 +869,23 @@ public:
_Delete_plain_internal(_Proxy_allocator, _STD exchange(_Get_data()._Myproxy, nullptr));
}

void _Copy_assign(const deque& _Right, false_type) {
_Pocca(_Getal(), _Right._Getal());
assign(_Right._Unchecked_begin(), _Right._Unchecked_end());
}

void _Copy_assign(const deque& _Right, true_type) {
if (_Getal() != _Right._Getal()) {
_Tidy();
_Get_data()._Reload_proxy(static_cast<_Alproxy_ty>(_Getal()), static_cast<_Alproxy_ty>(_Right._Getal()));
deque& operator=(const deque& _Right) {
if (this == _STD addressof(_Right)) {
return *this;
}

_Copy_assign(_Right, false_type{});
}

deque& operator=(const deque& _Right) {
if (this != _STD addressof(_Right)) {
_Copy_assign(_Right, _Choose_pocca<_Alty>{});
auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
if constexpr (_Choose_pocca_v<_Alty>) {
if (_Al != _Right_al) {
_Tidy();
_Get_data()._Reload_proxy(static_cast<_Alproxy_ty>(_Al), static_cast<_Alproxy_ty>(_Right_al));
}
}

_Pocca(_Al, _Right_al);
assign(_Right._Unchecked_begin(), _Right._Unchecked_end());

return *this;
}

Expand Down
91 changes: 41 additions & 50 deletions stl/inc/forward_list
Original file line number Diff line number Diff line change
Expand Up @@ -630,41 +630,35 @@ public:
_Take_head(_Right);
}

private:
void _Move_assign(forward_list& _Right, _Equal_allocators) noexcept {
clear();
_Pocma(_Getal(), _Right._Getal());
_Take_head(_Right);
}

void _Move_assign(forward_list& _Right, _Propagate_allocators) noexcept {
if (_Getal() == _Right._Getal()) {
_Move_assign(_Right, _Equal_allocators{});
} else {
_Mypair._Myval2._Orphan_all();
clear();
_Mypair._Myval2._Reload_proxy(
_GET_PROXY_ALLOCATOR(_Alty, _Getal()), _GET_PROXY_ALLOCATOR(_Alty, _Right._Getal()));
_Pocma(_Getal(), _Right._Getal());
_Take_head(_Right);
}
}

void _Move_assign(forward_list& _Right, _No_propagate_allocators) {
if (_Getal() == _Right._Getal()) {
_Move_assign(_Right, _Equal_allocators{});
} else {
_Assign_unchecked(_STD make_move_iterator(_Right._Unchecked_begin()), _Right._Unchecked_end());
}
}

public:
forward_list& operator=(forward_list&& _Right) noexcept(
noexcept(_Move_assign(_Right, _Choose_pocma<_Alnode>{}))) /* strengthened */ {
if (this != _STD addressof(_Right)) {
_Move_assign(_Right, _Choose_pocma<_Alnode>{});
_Choose_pocma_v<_Alnode> != _Pocma_values::_No_propagate_allocators) /* strengthened */ {
if (this == _STD addressof(_Right)) {
return *this;
}

auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
constexpr auto _Pocma_val = _Choose_pocma_v<_Alnode>;
if constexpr (_Pocma_val == _Pocma_values::_Propagate_allocators) {
if (_Al != _Right_al) {
_Mypair._Myval2._Orphan_all();
clear();
_Mypair._Myval2._Reload_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Al), _GET_PROXY_ALLOCATOR(_Alty, _Right_al));
_Pocma(_Al, _Right_al);
_Take_head(_Right);
return *this;
}
} else if constexpr (_Pocma_val == _Pocma_values::_No_propagate_allocators) {
if (_Al != _Right_al) {
_Assign_unchecked(_STD make_move_iterator(_Right._Unchecked_begin()), _Right._Unchecked_end());
return *this;
}
}

clear();
_Pocma(_Al, _Right_al);
_Take_head(_Right);
return *this;
}

Expand Down Expand Up @@ -744,29 +738,26 @@ public:
#endif // _ITERATOR_DEBUG_LEVEL != 0
}

private:
void _Copy_assign(const forward_list& _Right, false_type) {
_Pocca(_Getal(), _Right._Getal());
_Assign_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end());
}

void _Copy_assign(const forward_list& _Right, true_type) {
if (_Getal() != _Right._Getal()) {
_Mypair._Myval2._Orphan_all();
clear();
_Mypair._Myval2._Reload_proxy(
_GET_PROXY_ALLOCATOR(_Alnode, _Getal()), _GET_PROXY_ALLOCATOR(_Alnode, _Right._Getal()));
}

_Copy_assign(_Right, _No_propagate_allocators{});
}

public:
forward_list& operator=(const forward_list& _Right) {
if (this != _STD addressof(_Right)) {
_Copy_assign(_Right, _Choose_pocca<_Alnode>{});
if (this == _STD addressof(_Right)) {
return *this;
}

auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
if constexpr (_Choose_pocca_v<_Alnode>) {
if (_Al != _Right_al) {
_Mypair._Myval2._Orphan_all();
clear();
_Mypair._Myval2._Reload_proxy(
_GET_PROXY_ALLOCATOR(_Alnode, _Al), _GET_PROXY_ALLOCATOR(_Alnode, _Right_al));
}
}

_Pocca(_Al, _Right_al);
_Assign_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end());

return *this;
}

Expand Down
102 changes: 47 additions & 55 deletions stl/inc/list
Original file line number Diff line number Diff line change
Expand Up @@ -898,50 +898,44 @@ public:
_Swap_val(_Right);
}

private:
void _Move_assign(list& _Right, _Equal_allocators) noexcept {
clear();
_Pocma(_Getal(), _Right._Getal());
_Swap_val(_Right);
}

void _Move_assign(list& _Right, _Propagate_allocators) {
auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
if (_Al == _Right_al) {
_Move_assign(_Right, _Equal_allocators{});
} else {
auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al);
auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al);
_Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{});
auto& _My_data = _Mypair._Myval2;
auto& _Right_data = _Right._Mypair._Myval2;
const auto _Newhead = _STD exchange(_Right_data._Myhead, _Node::_Buyheadnode(_Right_al));
const auto _Newsize = _STD exchange(_Right_data._Mysize, size_type{0});
_Tidy();
_Pocma(_Al, _Right_al);
_My_data._Myhead = _Newhead;
_My_data._Mysize = _Newsize;
_Proxy._Bind(_Alproxy, _STD addressof(_My_data));
_My_data._Swap_proxy_and_iterators(_Right_data);
public:
list& operator=(list&& _Right) noexcept(
_Choose_pocma_v<_Alnode> == _Pocma_values::_Equal_allocators) /* strengthened */ {
if (this == _STD addressof(_Right)) {
return *this;
}
}

void _Move_assign(list& _Right, _No_propagate_allocators) {
if (_Getal() == _Right._Getal()) {
_Move_assign(_Right, _Equal_allocators{});
} else {
assign(
_STD make_move_iterator(_Right._Unchecked_begin()), _STD make_move_iterator(_Right._Unchecked_end()));
auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
constexpr auto _Pocma_val = _Choose_pocma_v<_Alnode>;
if constexpr (_Pocma_val == _Pocma_values::_Propagate_allocators) {
if (_Al != _Right_al) {
auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al);
auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al);
_Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{});
auto& _My_data = _Mypair._Myval2;
auto& _Right_data = _Right._Mypair._Myval2;
const auto _Newhead = _STD exchange(_Right_data._Myhead, _Node::_Buyheadnode(_Right_al));
const auto _Newsize = _STD exchange(_Right_data._Mysize, size_type{0});
_Tidy();
_Pocma(_Al, _Right_al);
_My_data._Myhead = _Newhead;
_My_data._Mysize = _Newsize;
_Proxy._Bind(_Alproxy, _STD addressof(_My_data));
_My_data._Swap_proxy_and_iterators(_Right_data);
return *this;
}
} else if constexpr (_Pocma_val == _Pocma_values::_No_propagate_allocators) {
if (_Al != _Right_al) {
assign(_STD make_move_iterator(_Right._Unchecked_begin()),
_STD make_move_iterator(_Right._Unchecked_end()));
return *this;
}
}
}

public:
list& operator=(list&& _Right) noexcept(
noexcept(_Move_assign(_Right, _Choose_pocma<_Alnode>{}))) /* strengthened */ {
if (this != _STD addressof(_Right)) {
_Move_assign(_Right, _Choose_pocma<_Alnode>{});
}
clear();
_Pocma(_Al, _Right_al);
_Swap_val(_Right);

return *this;
}
Expand Down Expand Up @@ -1057,25 +1051,23 @@ private:
_Proxy._Bind(_Alproxy, _STD addressof(_Mypair._Myval2));
}

void _Copy_assign(const list& _Right, false_type) {
_Pocca(_Getal(), _Right._Getal());
assign(_Right._Unchecked_begin(), _Right._Unchecked_end());
}

void _Copy_assign(const list& _Right, true_type) {
if (_Getal() != _Right._Getal()) {
_Reload_sentinel_and_proxy(_Right);
}

assign(_Right._Unchecked_begin(), _Right._Unchecked_end());
}

public:
list& operator=(const list& _Right) {
if (this != _STD addressof(_Right)) {
_Copy_assign(_Right, _Choose_pocca<_Alnode>{});
if (this == _STD addressof(_Right)) {
return *this;
}

auto& _Al = _Getal();
auto& _Right_al = _Right._Getal();
if constexpr (_Choose_pocca_v<_Alnode>) {
if (_Al != _Right_al) {
_Reload_sentinel_and_proxy(_Right);
}
} else {
_Pocca(_Al, _Right_al);
}

assign(_Right._Unchecked_begin(), _Right._Unchecked_end());
return *this;
}

Expand Down
31 changes: 12 additions & 19 deletions stl/inc/sstream
Original file line number Diff line number Diff line change
Expand Up @@ -204,27 +204,20 @@ public:
_Init(_Newstr.c_str(), _Newstr.size(), _Mystate);
}

void _Str(_Mystr&& _Newstr, _Equal_allocators) {
_Tidy();
_Pocma(_Al, _Newstr._Getal());
_Init_string_inplace(_STD move(_Newstr), _Mystate);
}

void _Str(_Mystr&& _Newstr, _Propagate_allocators) {
_Str(_STD move(_Newstr), _Equal_allocators{});
}

void _Str(_Mystr&& _Newstr, _No_propagate_allocators) {
if (_Al == _Newstr._Getal()) {
_Str(_STD move(_Newstr), _Equal_allocators{});
} else {
_Tidy();
_Init(_Newstr.c_str(), _Newstr.size(), _Mystate);
void str(_Mystr&& _Newstr) {
auto& _Newstr_al = _Newstr._Getal();
constexpr auto _Pocma_val = _Choose_pocma_v<_Alloc>;
if constexpr (_Pocma_val == _Pocma_values::_No_propagate_allocators) {
if (_Al != _Newstr_al) {
_Tidy();
_Init(_Newstr.c_str(), _Newstr.size(), _Mystate);
return;
}
}
}

void str(_Mystr&& _Newstr) {
_Str(_STD move(_Newstr), _Choose_pocma<_Alloc>{});
_Tidy();
_Pocma(_Al, _Newstr_al);
_Init_string_inplace(_STD move(_Newstr), _Mystate);
}

_NODISCARD allocator_type get_allocator() const noexcept {
Expand Down
Loading