[PATCH] Implement std::experimental::sample

Marshall Clow mclow.lists at gmail.com
Thu Apr 30 08:40:30 PDT 2015


> The new tests don't test the instability of the reservoir sampling algorithm. Should they?


Yes - but I won't hold up accepting this because that test is missing.

The phrase in the standard "stable if and only if"...


================
Comment at: test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp:44
@@ +43,3 @@
+    for (int j = 1; j < kSampleSize; ++j)
+      assert(oa[j] > oa[j - 1]);
+  }
----------------
Couldn't this just be a call to `std::is_sorted(first, last)` ?

http://reviews.llvm.org/D9044

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list