[PATCH] Implement std::experimental::sample

Eric Fiselier eric at efcs.ca
Thu Apr 30 18:10:29 PDT 2015


Here is an updated patch that fixes most of my concerns: https://gist.github.com/EricWF/c62b0979202cfd2cc6af

I've made the following changes:

- Fixes issues regarding the type of `_Distance`.
- Always select the selection sample algorithm when `_PopulationIter` is a `ForwardIterator`.
- Include `<__undef_min_max>` because min/max are used.
- Add _LIBCPP_DEBUG assert when `Distance` is negative.
- Get tests compiling in C++03.
- Adds more tests relating to adding the header `<experimental/algorithm>`.
- Update double include header test to include `<experimental/algorithm>`.
- Update the documentation regarding the status of LFTS Algorithms.




================
Comment at: include/experimental/algorithm:74
@@ +73,3 @@
+    _Distance __r =
+        _VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
+    if (__r < __n) {
----------------
EricWF wrote:
> Do we need to re-construct the `uniform_int_distribution` every iteration?
Not sure what I was thinking. Obviously we do.

http://reviews.llvm.org/D9044

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






More information about the cfe-commits mailing list