[libcxx-commits] [PATCH] D58332: Erase-Like Algorithms Should Return size_type (P0646R1)

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 4 09:25:36 PDT 2019


zoecarver marked an inline comment as done.
zoecarver added a comment.

In D58332#1455053 <https://reviews.llvm.org/D58332#1455053>, @mclow.lists wrote:

> A meta-question:
>  Why does `list<_Tp, _Alloc>::remove(const value_type& __x)` gather all the deleted nodes into a separate list, while
>  `list<_Tp, _Alloc>::remove_if(_Pred __pred)` and `list<_Tp, _Alloc>::unique()` just delete them as they go?
>
> they're all the same operation under the hood.
>  [ I know you didn't create this difference. ]


Actually very happy you asked about this, I meant to ask the same thing but forgot.



================
Comment at: include/list:2172
 {
+    typename list<_Tp, _Alloc>::size_type __count_removed = 0;
     for (iterator __i = begin(), __e = end(); __i != __e;)
----------------
mclow.lists wrote:
> same as L2203. Just use `size()`
Forgot `size` was a member... will do. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58332/new/

https://reviews.llvm.org/D58332





More information about the libcxx-commits mailing list