Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-10-30 15:10:53

On Thu, Oct 30, 2003 at 09:37:58AM -1000, David Abrahams wrote:
> "Peter Dimov" <pdimov_at_[hidden]> writes:
> >> I don't agree with std::nth_element() taking zero to mean first,
> >> but it's in the Standard. That makes it a solid precedent.
> >
> > Have you looked at the signature of std::nth_element? ;-)
> That was the first thing I looked up, and why I didn't mention this
> example ;-)
> My sense of this is that C++ makes counting from 1 simply
> incovenient. If you want to make an array of pointers to each
> occurrence of a substring, and the search algorithm counts from 1,
> you either have to add 1 to the array index or subtract one from the
> ordinal.
> After thinking about this problem, I see little use for the algorithm
> in question which doesn't involve finding *each* occurrence starting
> from the first. There's a much simpler way to do that using
> std::find() and iterators. Maybe this one should just be stripped if
> we can't agree on what it should mean.

I'm currently finishing work on find_iterators. It is the requested
alternative/replacement for split algorithms found in the library.

Such an iterator can easily replace find_nth, but it could not
be true for other *_nth algorithms like erase_nth.

Question is if the *_nth algorithm are usable at all. I can imagine
their use on table processing or file name parsing.
But without real user input it is hard to estimate this. However it is
clear, that functionality they provide is not so conviniently achivable by
other means.


Boost list run by bdawes at, gregod at, cpdaniel at, john at