43 copy(__begin, __end, ostream_iterator<typename T::value_type>(out,
" "));
56int main(
int argc,
char **argv)
65 JParser<> zap(
"Auxiliary program to test object selection methods.");
71 catch(
const exception &error) {
72 FATAL(error.what() << endl);
77 buffer.push_back(__A__(3));
78 buffer.push_back(__A__(4));
79 buffer.push_back(__A__(2));
80 buffer.push_back(__A__(1));
81 buffer.push_back(__A__(5));
84 print(cout,
debug,
"data:", buffer.begin(), buffer.end());
89 vector<__A__>::const_iterator p = find_if(buffer.begin(), buffer.end(), make_predicate(&__A__::a, x));
91 DEBUG(
"has " << x <<
"? " << (p != buffer.end() ?
"yes" :
"no") << endl);
93 ASSERT(p != buffer.end() && p->a == x);
97 vector<__A__>::const_iterator p = find_if(buffer.begin(), buffer.end(), make_predicate(&__A__::get, x));
99 DEBUG(
"has " << x <<
"? " << (p != buffer.end() ?
"yes" :
"no") << endl);
101 ASSERT(p != buffer.end() && p->get() == x);
107 print(cout,
debug,
"selection:", buffer.begin(), p);
115 ASSERT(count_if(buffer.begin(), buffer.end(), make_predicate(&__A__::a, 1,
JComparison::eq())) == 1);
116 ASSERT(count_if(buffer.begin(), buffer.end(), make_predicate(&__A__::a, 2,
JComparison::gt())) == 3);