Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-10-19 15:28:18


At 09:06 AM 10/19/2003, Thorsten Ottosen wrote:

>C++ is not a pure functional language and inplace mutating algorithms are
>all over the place.
>
>I don't have more to say about this; I acknowledge that you have a
>different view and I agree it would be nice to hear other people's
opinion.

Like Daniel, I'm also concerned that some of the string_algo mutating
functions may be error prone.

It isn't just that these functions are mutating. It is that they mutate
their inputs without giving users much of a clue.

For example, the current Standard Library mutating algorithms [25.2] use
three techniques which tend to alert users to their mutating nature:

    12 have "result" arguments
    12 have void returns
     7 add "_copy" to the name

Four use more than one of the above techniques.

When looked at from that perspective, the std mutating functions which
don't offer some form of clue (remove, unique, partition, stable_partitiou)
seem deficient.

I definitely think the string_algo interfaces should be revised to reduce
the chance of misuse.

--Beman


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