Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2003-10-30 15:20:32


From: "Peter Dimov" <pdimov_at_[hidden]>
> Rob Stewart wrote:
> > From: Daniel Spangenberg
> >> Rob Stewart schrieb:
> >>
> >>> Because s[0] isn't the 0th element; it's the first. As I said,
> >>> we use ordinals to refer to things like this. Addressing an
> >>> element uses an index, and indexes start at zero. "nth"
> >>> explicitly refers to ordinals, and there's no 0th; you start with
> >>> 1st, so find_nth() should reasonably start numbering from one.
> >>>
> >>>> You can think of find_nth as indexing into a view onto the matching
> >>>> substrings of s if you want.
> >>
> >> You you are right, but 0th is consistent to the naming of the std
> >> algorithm nth_element.
> >
> > 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? ;-)

Actually, I searched to find it and then skimmed the description,
assuming that Daniel had looked more closely. I didn't look at
the signature until you questioned me.

As it turns out, std::nth_element() operates strictly with
iterators and returns void! Doh!

Given my now enlightened understanding of nth_element, I don't
consider it analogous to find_nth() at all, so you can consider
all of my capitulation above rescinded!

Choosing a different name will resolve the problem as previously
stated.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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