Thanks to visit codestin.com
Credit goes to github.com

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
8 changes: 4 additions & 4 deletions stl/inc/forward_list
Original file line number Diff line number Diff line change
Expand Up @@ -1208,12 +1208,12 @@ public:
_Nodeptr* _Tail;
};

auto remove(const _Ty& _Val) { // erase each element matching _Val
_LIST_REMOVE_RETURN remove(const _Ty& _Val) { // erase each element matching _Val
return remove_if([&](const _Ty& _Other) -> bool { return _Other == _Val; });
}

template <class _Pr1>
auto remove_if(_Pr1 _Pred) { // erase each element satisfying _Pr1
_LIST_REMOVE_RETURN remove_if(_Pr1 _Pred) { // erase each element satisfying _Pr1
_Flist_node_remove_op _Op(*this);
auto _Firstb = _Unchecked_before_begin();
size_type _Removed = 0;
Expand All @@ -1235,12 +1235,12 @@ public:
#endif
}

auto unique() { // erase each element matching previous
_LIST_REMOVE_RETURN unique() { // erase each element matching previous
return unique(equal_to<>{});
}

template <class _Pr2>
auto unique(_Pr2 _Pred) { // erase each element satisfying _Pred with previous
_LIST_REMOVE_RETURN unique(_Pr2 _Pred) { // erase each element satisfying _Pred with previous
_Flist_node_remove_op _Op(*this);
auto _First = _Unchecked_begin();
size_type _Removed = 0;
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/list
Original file line number Diff line number Diff line change
Expand Up @@ -1662,12 +1662,12 @@ public:
_Nodeptr* _Tail;
};

auto remove(const _Ty& _Val) { // erase each element matching _Val
_LIST_REMOVE_RETURN remove(const _Ty& _Val) { // erase each element matching _Val
return remove_if([&](const _Ty& _Other) -> bool { return _Other == _Val; });
}

template <class _Pr1>
auto remove_if(_Pr1 _Pred) { // erase each element satisfying _Pred
_LIST_REMOVE_RETURN remove_if(_Pr1 _Pred) { // erase each element satisfying _Pred
auto& _My_data = _Mypair._Myval2;
_List_node_remove_op _Op(*this);
const auto _Last = _My_data._Myhead;
Expand All @@ -1688,12 +1688,12 @@ public:
#endif
}

auto unique() { // erase each element matching previous
_LIST_REMOVE_RETURN unique() { // erase each element matching previous
return unique(equal_to<>{});
}

template <class _Pr2>
auto unique(_Pr2 _Pred) { // erase each element satisfying _Pred with previous
_LIST_REMOVE_RETURN unique(_Pr2 _Pred) { // erase each element satisfying _Pred with previous
_List_node_remove_op _Op(*this);
const _Nodeptr _Phead = _Mypair._Myval2._Myhead;
_Nodeptr _Pprev = _Phead->_Next;
Expand Down
6 changes: 6 additions & 0 deletions stl/inc/xmemory
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,12 @@ _STD_END
#define _CONTAINER_EMPLACE_RETURN void
#endif // ^^^ !_HAS_CXX17 ^^^

#if _HAS_CXX20
#define _LIST_REMOVE_RETURN size_type
#else // ^^^ _HAS_CXX20 ^^^ / vvv !_HAS_CXX20 vvv
#define _LIST_REMOVE_RETURN void
#endif // ^^^ !_HAS_CXX20 ^^^

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down