Revert "Revert "Merge to upstream r304942.""
This reverts commit 38a0d5af7e.
Test: make checkbuild
Test: ./run_tests.py
Test: ./run_tests.py --bitness 64
This commit is contained in:
@@ -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<const int*>(ia),
|
||||
input_iterator<const int*>(ia + sa),
|
||||
std::bind2nd(std::equal_to<int>(),2)) == 3);
|
||||
eq(2)) == 3);
|
||||
assert(std::count_if(input_iterator<const int*>(ia),
|
||||
input_iterator<const int*>(ia + sa),
|
||||
std::bind2nd(std::equal_to<int>(),7)) == 0);
|
||||
eq(7)) == 0);
|
||||
assert(std::count_if(input_iterator<const int*>(ia),
|
||||
input_iterator<const int*>(ia),
|
||||
std::bind2nd(std::equal_to<int>(),2)) == 0);
|
||||
eq(2)) == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user