Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-08-09 05:31:43


From: David Abrahams <dave_at_[hidden]>
> "Andy Little" <andy_at_[hidden]> writes:
> > "David Abrahams" <dave_at_[hidden]> wrote
> >> Rob Stewart <stewart_at_[hidden]> writes:
> >
> >>>> all_of(a)._(frobnicates, any_of(b))
> >>>> all_of(a)._,frobnicates, any_of(b)
> >>>> all_of(a)._ %frobnicates% any_of(b)
> >>>> all_of(a)._ |frobnicates| any_of(b)
> >>>> all_of(a)._ <frobnicates> any_of(b)
> >>> all_of(a)(frobnicates, any_of(b))
> >
> > Yuck and Yuck FWIW. AFAIK only prefix user defined operations work in C++.
> >
> > 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>()

I didn't notice this earlier, but I'm not sure if we can achieve
your goal. The current implementation of an expression like

   any_of(a) <frobnicates> any_of(b)

is to iterate the range in a calling frobnicates with each value
from a with any_of(b). That expression gets reversed suitably
such that it iterates the values in b calling frobnicates with
the each value in b and the one value from a.

I'll have to take another look at how I've implemented things to
see whether I can achieve the goal you've set, because I can see
the value in meeting it.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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