Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2005-08-08 10:45:53


"Rob Stewart" wrote:

> We presently support these operations:
>
> all
> any
> each
> n_m
> n
> none
> not_all
> one
>
...
> |each | if each succeeds independently, the expression
> | | is true
>

I didn't find time to study neither of the current
implementations (you both code faster than I can read ;-)
so I am bit confused by the difference between
"each" and "all".

"all_except_one" is quite common situation
which may be considered too.

Is the "more_of(x) < more_of(y)"
feature implementable?

> How do these look?
>
> at_least(n).of(a)
> between(x, y).of(a)
> exactly(n).of(a)
> less_than(n).of(a)
> more_than(n).of(a)
>

The "of" may be easily overlooked.
A "item_of" or so would be harder to miss.

> Should we include "percent_of?"
>

With this (or "fraction_of" or so) user won't be bothered
to extract size of a range manually.
His code would be bit simpler.

If the range size is hard to compute
(some std::list implementations)
it may be also more efficient.

> Should we provide the alternate spellings like "at_least,"
> "more_than," and "one?"
>
IMO yes. It would allow user to pick the best
word in given context

(Or at least ability to use a convenient word w/o searching
through documentation for the oficially blessed variant.)

-----------------------

Will it be possible to have one range in the expressions above
fitting InputIterator model?

For example:
   none_of(integers_stored_in_large_and_slow_file) > any_of(values)

Perhaps the library may detect such situation and
work around the InputIterator limitations.

Alternatively: would be possible to give a hint
to the algorithm which range is larger (more expensive
to traverse) to optimize the result?

Say something as:

none_of(a).traverse_once() > all_of(b)

/Pavel


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