[PATCH] Implement std::experimental::sample

Evgeniy Stepanov eugenis at google.com
Thu Apr 30 18:25:24 PDT 2015


================
Comment at: include/experimental/algorithm:74
@@ +73,3 @@
+    _Distance __r =
+        _VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
+    if (__r < __n) {
----------------
EricWF wrote:
> EricWF wrote:
> > Do we need to re-construct the `uniform_int_distribution` every iteration?
> Not sure what I was thinking. Obviously we do.
Well, uniform_int_distribution has an overload of operator() that can change the distribution parameters without re-creating the object, but it does exactly the same amount of work.

http://reviews.llvm.org/D9044

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






More information about the cfe-commits mailing list