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

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 4 08:43:06 PDT 2019


mclow.lists added a comment.

Ok, so your update and my comments passed in flight. I'll try again :-)



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


================
Comment at: include/list:2203
 {
+    typename list<_Tp, _Alloc>::size_type __count_removed = 0;
     for (iterator __i = begin(), __e = end(); __i != __e;)
----------------
You don't have to do this work for `list`, because it has a constant-time `size()` member.

Just call `size()` at the start, and again at the end, and return the difference.


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

https://reviews.llvm.org/D58332





More information about the libcxx-commits mailing list