From 040411762fde039dcd1a7f513d95d01266bfa94d Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 28 Aug 2016 21:55:00 +0000 Subject: 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 --- .../algorithms/alg.random.sample/sample.pass.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp') 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 : public ReservoirSampleExpectations {}; -template class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> +template class PopulationIteratorType, class PopulationItem, + template class SampleIteratorType, class SampleItem> void test() { typedef PopulationIteratorType PopulationIterator; typedef SampleIteratorType 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 class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> +template class PopulationIteratorType, class PopulationItem, + template class SampleIteratorType, class SampleItem> void test_empty_population() { typedef PopulationIteratorType PopulationIterator; typedef SampleIteratorType SampleIterator; @@ -88,8 +88,8 @@ void test_empty_population() { assert(end.base() == oa); } -template class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> +template class PopulationIteratorType, class PopulationItem, + template class SampleIteratorType, class SampleItem> void test_empty_sample() { typedef PopulationIteratorType PopulationIterator; typedef SampleIteratorType SampleIterator; @@ -103,8 +103,8 @@ void test_empty_sample() { assert(end.base() == oa); } -template class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> +template class PopulationIteratorType, class PopulationItem, + template class SampleIteratorType, class SampleItem> void test_small_population() { // The population size is less than the sample size. typedef PopulationIteratorType PopulationIterator; -- cgit v1.2.3