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 --- .../algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libcxx/test/std/algorithms/alg.nonmodifying/alg.count') diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp index 025bc06a618..0a05c6f659c 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp @@ -20,17 +20,24 @@ #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, 2, 0, 1, 2, 3}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); assert(std::count_if(input_iterator(ia), input_iterator(ia + sa), - std::bind2nd(std::equal_to(),2)) == 3); + eq(2)) == 3); assert(std::count_if(input_iterator(ia), input_iterator(ia + sa), - std::bind2nd(std::equal_to(),7)) == 0); + eq(7)) == 0); assert(std::count_if(input_iterator(ia), input_iterator(ia), - std::bind2nd(std::equal_to(),2)) == 0); + eq(2)) == 0); } -- cgit v1.2.3