diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:03:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:03:23 +0000 |
| commit | 0dc0969cd0a732760f0aa79942a04e0eaef297c4 (patch) | |
| tree | 051bdb57b1ac6ee143f61ddbb47bd0da619f6f0c /test/std/algorithms/alg.modifying.operations | |
| parent | 868847c6900e575417c03bced6e562b3af891318 (diff) | |
Notes
Diffstat (limited to 'test/std/algorithms/alg.modifying.operations')
6 files changed, 17 insertions, 7 deletions
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp index e24598a9bc127..e2abf7cce42e7 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // <algorithm> +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template<RandomAccessIterator Iter> // requires ShuffleIterator<Iter> diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp index c923d847f11e7..313b6bac402ea 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // <algorithm> +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template<RandomAccessIterator Iter, Callable<auto, Iter::difference_type> Rand> // requires ShuffleIterator<Iter> diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp index de3f0a741045f..1cf2d9e845620 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp @@ -21,6 +21,8 @@ #include "test_iterators.h" +bool equalToTwo(int v) { return v == 2; } + template <class InIter, class OutIter> void test() @@ -28,8 +30,8 @@ test() int ia[] = {0, 1, 2, 3, 4, 2, 3, 4, 2}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa]; - OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib), - std::bind2nd(std::equal_to<int>(), 2)); + OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa), + OutIter(ib), equalToTwo); assert(base(r) == ib + sa-3); assert(ib[0] == 0); assert(ib[1] == 1); diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp index 1eff3d39e20e8..f2ffece12e8b0 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp @@ -23,6 +23,8 @@ #include "test_iterators.h" +bool equalToTwo(int v) { return v == 2; } + template <class InIter, class OutIter> void test() @@ -30,8 +32,8 @@ test() int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa] = {0}; - OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib), - std::bind2nd(std::equal_to<int>(), 2), 5); + OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa), + OutIter(ib), equalToTwo, 5); assert(base(r) == ib + sa); assert(ib[0] == 0); assert(ib[1] == 1); diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp index 8d6ab04e14ddc..ebb2945d7c434 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp @@ -22,13 +22,15 @@ #include "test_iterators.h" +bool equalToTwo(int v) { return v == 2; } + template <class Iter> void test() { int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); - std::replace_if(Iter(ia), Iter(ia+sa), std::bind2nd(std::equal_to<int>(), 2), 5); + std::replace_if(Iter(ia), Iter(ia+sa), equalToTwo, 5); assert(ia[0] == 0); assert(ia[1] == 1); assert(ia[2] == 5); diff --git a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp index 68556fd988175..6c5e621e4b20a 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp @@ -21,6 +21,8 @@ #include "test_iterators.h" +int plusOne(int v) { return v + 1; } + template <class InIter, class OutIter> void test() @@ -28,8 +30,8 @@ test() int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa] = {0}; - OutIter r = std::transform(InIter(ia), InIter(ia+sa), OutIter(ib), - std::bind2nd(std::plus<int>(), 1)); + OutIter r = std::transform(InIter(ia), InIter(ia+sa), + OutIter(ib), plusOne); assert(base(r) == ib + sa); assert(ib[0] == 1); assert(ib[1] == 2); |
