Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-22 12:41:42


Pavol Droba wrote:
>
> Problem is, that there is nothing like algorithms library currently
> in the boost. Once, the other libraries will be reviewed, some
> reordering can be performed.
> It is hard to make a border between two countries, when there only
> one.
>
> all() predicate was added to the string_algo library, because, there
> was a request to handle classification of a string. (i.e a sequence
> variant of std::isspace and etc). all() with a set of classification
> predicated was a natural choice for this task.

I haven't studied the library in enough detail to write a proper review, but
that's one of the issues I see with it, there is too much algorithm
duplication:

    all(x, f) :- find_if(x.begin(), x.end(), not1(f)) == x.end()

and it is not clear where the line has been drawn and why.

Part of the problem is that the library isn't really a string algorithm
library, it's a container algorithm library with string-like operations.
There isn't anything wrong with that but the focus is lost.

For example,

    bool isspace(std::basic_string<T> const & t, std::locale const & l);

is much less controversial than the generic 'all'.

The other issue that I see after a cursory look can be summarized as
'trim_left_copy_if'. The verbosity of some of the names does not correspond
to the frequency of their use. Once again, I'd rather see

    std::basic_string<T> ltrim(std::basic_string<T> const & input);
    std::basic_string<T> ltrim(std::basic_string<T> const & input, Pr
isspace);

and relegate

    void erase_prefix_if(Container & c, Pr filter);

to a separate container library.


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