diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-08-28 21:55:00 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-08-28 21:55:00 +0000 |
commit | 040411762fde039dcd1a7f513d95d01266bfa94d (patch) | |
tree | 338fa1d4c00cf3359ee9a454ba34b53d073ca798 /libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp | |
parent | 61c0b0c32a0a14003f65c84d3bceec7eb3c10c3d (diff) | |
download | bcm5719-llvm-040411762fde039dcd1a7f513d95d01266bfa94d.tar.gz bcm5719-llvm-040411762fde039dcd1a7f513d95d01266bfa94d.zip |
Mark LWG 2716 as complete - shuffle and sample disallows lvalue URNGs.
Libc++'s implementation of shuffle and sample already support lvalue and rvalue
RNG's. This patch adds tests for both categories and marks the issue as complete.
This patch also contains drive-by change for std::experimental::sample which
improves the diagnostics produced when the correct iterator categories are
not supplied.
llvm-svn: 279947
Diffstat (limited to 'libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp')
-rw-r--r-- | libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp index 1a9f9b099b2..531731791c5 100644 --- a/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp +++ b/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp @@ -46,8 +46,8 @@ template <> struct TestExpectations<std::input_iterator_tag> : public ReservoirSampleExpectations {}; -template <template<class> class PopulationIteratorType, class PopulationItem, - template<class> class SampleIteratorType, class SampleItem> +template <template<class...> class PopulationIteratorType, class PopulationItem, + template<class...> class SampleIteratorType, class SampleItem> void test() { typedef PopulationIteratorType<PopulationItem *> PopulationIterator; typedef SampleIteratorType<SampleItem *> SampleIterator; @@ -68,13 +68,13 @@ void test() { assert(std::equal(oa, oa + os, oa1)); end = std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), - SampleIterator(oa), os, g); + SampleIterator(oa), os, std::move(g)); assert(end.base() - oa == std::min(os, is)); assert(std::equal(oa, oa + os, oa2)); } -template <template<class> class PopulationIteratorType, class PopulationItem, - template<class> class SampleIteratorType, class SampleItem> +template <template<class...> class PopulationIteratorType, class PopulationItem, + template<class...> class SampleIteratorType, class SampleItem> void test_empty_population() { typedef PopulationIteratorType<PopulationItem *> PopulationIterator; typedef SampleIteratorType<SampleItem *> SampleIterator; @@ -88,8 +88,8 @@ void test_empty_population() { assert(end.base() == oa); } -template <template<class> class PopulationIteratorType, class PopulationItem, - template<class> class SampleIteratorType, class SampleItem> +template <template<class...> class PopulationIteratorType, class PopulationItem, + template<class...> class SampleIteratorType, class SampleItem> void test_empty_sample() { typedef PopulationIteratorType<PopulationItem *> PopulationIterator; typedef SampleIteratorType<SampleItem *> SampleIterator; @@ -103,8 +103,8 @@ void test_empty_sample() { assert(end.base() == oa); } -template <template<class> class PopulationIteratorType, class PopulationItem, - template<class> class SampleIteratorType, class SampleItem> +template <template<class...> class PopulationIteratorType, class PopulationItem, + template<class...> class SampleIteratorType, class SampleItem> void test_small_population() { // The population size is less than the sample size. typedef PopulationIteratorType<PopulationItem *> PopulationIterator; |