|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-11-02 00:47:35
"Pavol Droba" <droba_at_[hidden]> wrote in message
news:20031101232101.GG27017_at_lenin.felcer.sk...
> 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.
> >
It's not that hard, is it?
How would your find algorithm look like?
> 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.
I find it a bit wrong to make such changes after the review. It should be
part of the second version of the library.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk