[libcxx-commits] [PATCH] D64260: [libc++] Erase-Like Algorithms in C++17 and below

Mikhail Maltsev via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 5 11:51:13 PDT 2019


miyuki created this revision.
miyuki added reviewers: ldionne, mclow.lists, EricWF.
Herald added subscribers: dexonsmith, christof.
Herald added a project: libc++.

A recent change https://reviews.llvm.org/D58332 implemented P0646R1.
However, the change does not fix any defects in the C++ Standard and
thus should not be applied retroactively.

This patch changes the return type of the `remove`, `remove_if` and
`unique` member functions of the class templates `list` and `forward_list`
back to `void` in versions prior to c++2a.

As the P0646R1 paper suggests, modern compilers are smart enough to
optimize out the code related to counting the number of removed
elements, so only minimal changes are required in the implementation
of the functions mentioned above.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64260

Files:
  libcxx/include/forward_list
  libcxx/include/list
  libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
  libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
  libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
  libcxx/test/std/containers/sequences/list/list.ops/remove.pass.cpp
  libcxx/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
  libcxx/test/std/containers/sequences/list/list.ops/unique.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64260.208217.patch
Type: text/x-patch
Size: 21286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190705/0f0ee784/attachment-0001.bin>


More information about the libcxx-commits mailing list