Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-11-01 18:21:01


On Sat, Nov 01, 2003 at 10:01:08AM -1000, David Abrahams wrote:
> Pavol Droba <droba_at_[hidden]> writes:

[snip]
 
> I would really, really like to see a use case which isn't handled more
> cleanly and just as easily with an iterator-based "find" algorithm.
> I think it's important not to shove functionality into a library
> before we can prove its usefulness. It's easy to add functionality
> later but it's very hard to remove it once a library is out.
>

There is one example, which alway hovers in my mind: Table manipulations.
You might want to make some tranformation in the second column for instance.

Problematic algorithm is not find_nth(). That one is realy covered by
find_iterator. But what about erase_nth and replace_nth?

Possible suggestion:

<code>

string str1="the text is text";
find_iterator it=make_find_first_iteraror("text");

//...advance to the second match
it++;

replace_range(str1,*it,"nonsense"); // str1=="the text is nonsense"

</code>

If this seem ok (in my opinion, it is), I will remove *_nth algos straight
away.

Regards,

Pavol


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