Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-10-23 00:41:48


On Thu, Oct 23, 2003 at 11:19:18AM +1000, Thorsten Ottosen wrote:

[snip]

>
> we're trying to guard our selves from a algorithm explosion problem. Having
> separate _chain
> variants makes it worse. As Peter Dimov said, you can easily make a function
> that does the same.
> Even some of the copy variants could be remoevd, since the string must be
> copy-constructible, so the
> user can just copy it by himself and then apply the mutating algorithm (I do
> think the copy versions are ok).
>
> As for the chaining, then maybe we need some device that allows of to call n
> function operation on eachother's result:
>
> string s:
> chain( &trim, &to_upper, s );
>

Whats is the problem with the current proposal? It declares three variants for each
algorithm:

1. _copy version, the result is copied to an output iterator
   - This variant, has least requirement on the input.
   - It is semantical equivalent of algorithms in STL
        - has no side effects

2. _copy version, the result is a copy of the input
   - Allows chaining
   - Has more requirements on the input-type, because it is used for result
        - has no side effects

3. inplace version. Input is modified
        - optimized implementation
   - returns void, to avoid a possibiliy of missuse
        - Has strongest requiremnts on the input type
   

Given these three variants we cover all the important cases. We have fast and safe inplace version.
We have copy version whith the chaining ability, and we have a version for an arbitrary input.

I'd like to close this issue. There were several supporters of this proposals. Is this acceptable for whole boost?

Pavol


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