From 315cd1fec9864bf974545a0860f50b8788f72c86 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 23 Mar 2017 16:13:50 +0000 Subject: Update the algorithm tests to not use the (deprecated) function binders. No functional change. llvm-svn: 298618 --- .../std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp | 10 ++++++++-- .../algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'libcxx/test/std/algorithms/alg.nonmodifying/alg.find') diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp index bde6ff389d0..c942d2e38a5 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp @@ -20,16 +20,22 @@ #include "test_iterators.h" +struct eq { + eq (int val) : v(val) {} + bool operator () (int v2) const { return v == v2; } + int v; + }; + int main() { int ia[] = {0, 1, 2, 3, 4, 5}; const unsigned s = sizeof(ia)/sizeof(ia[0]); input_iterator r = std::find_if(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::equal_to(), 3)); + eq(3)); assert(*r == 3); r = std::find_if(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::equal_to(), 10)); + eq(10)); assert(r == input_iterator(ia+s)); } diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp index 661e643f07d..e68344b4b25 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp @@ -20,16 +20,23 @@ #include "test_iterators.h" +struct ne { + ne (int val) : v(val) {} + bool operator () (int v2) const { return v != v2; } + int v; + }; + + int main() { int ia[] = {0, 1, 2, 3, 4, 5}; const unsigned s = sizeof(ia)/sizeof(ia[0]); input_iterator r = std::find_if_not(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::not_equal_to(), 3)); + ne(3)); assert(*r == 3); r = std::find_if_not(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::not_equal_to(), 10)); + ne(10)); assert(r == input_iterator(ia+s)); } -- cgit v1.2.3