Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-08-06 06:03:34


"David Abrahams" <dave_at_[hidden]> wrote
> "Andy Little" <andy_at_[hidden]> writes:

>> if ( frobnicates(all_of(a), any_of(b))) {
>
> You can't do that unless you ask people to put smarts about all_of and
> any_of inside of frobnicates. The goal is to use a general predicate
> such as std::less<int>()

Ok I see.
Of course you can achieve this simply via one overloaded function.

bool b1 = question<std::less>(all_of(a),any_of(b) );
bool b2 = question(frobnicates,all_of(a),any_of(b) );

The use of the dummy expression |frobnicates| is a poor substitute for a user
defined operator. Should C++ incorporate a facility to define ones own
operators?

regards
Andy Little


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk