[libcxx-commits] [PATCH] D130321: [libc++][ranges] Implement `ranges::shuffle`.

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 22 10:26:03 PDT 2022


jloser added inline comments.


================
Comment at: libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/ranges_shuffle.pass.cpp:242
+
+  { // Complexity: Exactly `(last - first) - 1` swaps.
+    {
----------------
ldionne wrote:
> var-const wrote:
> > The standard requirement that the number of swaps is "exact" instead of "at most" doesn't make sense to me. Is this a wording issue, or am I missing something?
> It is somewhat unusual indeed -- I don't think anybody would complain for making fewer swaps than specified.
There are some algorithms that enforce exactly a certain number of swaps (like `swap_ranges`), but I think the wording should be changed to say "at most" rather than "exactly" for `ranges::shuffle`. I filed https://github.com/cplusplus/draft/issues/5636 for clarification. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130321



More information about the libcxx-commits mailing list