C++ Logo

std-proposals

Advanced search

Re: Finding the index of an element (std::find_first_index)

From: Matthew Woehlke <mwoehlke.floss_at_[hidden]>
Date: Thu, 1 Oct 2020 13:31:52 -0400
On 01/10/2020 12.56, Kosher Yosher via Std-Proposals wrote:
> The return type of std::distance also doesn't
> cover the entire container range.

This is (mostly) untrue; there is actually a proof floating around
somewhere that it is impossible for an in-memory container to have more
than numeric_limits<intptr_t>::max() elements.

That said, it would seem to make sense for the result type to be the
same as the indexing type... although *both* of those ought to be
signed. Unfortunately, that ship sailed some time ago.

-- 
Matthew

Received on 2020-10-01 12:31:57