Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-08-10 12:51:07


Rob Stewart <stewart_at_[hidden]> writes:

> I just took a look at my implementation of all and each. At
> least in my latest version, it's worse than you describe. They
> are identical. Regardless of how I've implemented them, these
> are the intended semantics:
>
> all: all of the values must match *the same* other value
>
> each: all of the values must match *some* other value
>
> Thus, all_of({1, 2, 3}) < any_of({3, 4}) means:
>
> 1 < 3: true
> 2 < 3: true
> 3 < 3: false
> 1 < 4: true
> 2 < 4: true
> 3 < 4: true
> result: true
>
> But, each_of({1, 2, 3}) < any_of({3, 4}) means:
>
> 1 < 3: true
> 2 < 3: true
> 3 < 3: false
> 3 < 4: true
> result: true

IMO that's terribly confusing. The first one should be

  all_of({1, 2, 3}) < one_of({3, 4})

And the second one should be

  all_of({1, 2, 3}) < any_of({3, 4})

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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