[libcxx-commits] [PATCH] D60027: Add shift functions (P0769)

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 29 21:03:35 PDT 2019


zoecarver created this revision.
zoecarver added reviewers: mclow.lists, ldionne, howard.hinnant.
Herald added subscribers: libcxx-commits, dexonsmith.

Adds `shift_right` and `shift_left` functions to algorythems as specified in P0769R2 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf>.

In this implementation, I use `std::advance` to shift the iterators instead of the proposed sample algorithm. This seems to work fine and be much faster, but there may be some reason not to do this which I am unaware of.

The document <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf> suggests that _only_ `shift_left` is a `constexpr` while all other functions/overloads are not. I think this is a typo, but I can update if needed.


Repository:
  rCXX libc++

https://reviews.llvm.org/D60027

Files:
  include/algorithm
  test/std/algorithms/algorithms.general/shift.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60027.192960.patch
Type: text/x-patch
Size: 5376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190330/0f54c405/attachment.bin>


More information about the libcxx-commits mailing list