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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 6 12:51:49 PDT 2019

ldionne added inline comments.

Comment at: libcxx/include/algorithm:5734
+shift_right(_It __first, _It __last, typename iterator_traits<_It>::difference_type __n)
zoecarver wrote:
> ldionne wrote:
> > We're making multiple passes over the whole range to get things like `__rbegin`. I can't imagine that's the only way of implementing this algorithm, and if so, that was certainly not the intent of the paper.
> > 
> > Did you look at https://github.com/danra/shift_proposal/blob/master/shift_proposal.h?
> I try not to look at the sample implementations, it's more fun that way :) In this case, the implementation is much more performant, so I will implement it (or something close). 
I understand, however this is a standard library. Even though it can be fun to implement stuff in the standard library, the primary goal of this software is not to be "fun to implement". Correctness and efficiency should be the primary motivations here -- let's keep that in mind.

I sound boring, I know :-)



More information about the libcxx-commits mailing list