Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-05-16 10:12:59


On Thursday 16 May 2002 10:53 am, Ian Whittley wrote:
> This allows the code to be written as:
>
> vector<int>::iterator i = find_if(a.begin(),a.end(), greater_than(x) &&
> less_than(y) );
>
> And i defy any C++ programmer to misunderstand that code!

How about this:

  vector<int>::iterator i = find_if(a.begin(), a.end(), _1 > x && _1 < y);

Check out the Boost.Lambda library just added for 1.28.0. I think you'll be
pleasantly surprised.

        Doug


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