C++ Logo


Advanced search

Subject: Re: [std-proposals] Finding the index of an element (std::find_first_index)
From: Matthew Woehlke (mwoehlke.floss_at_[hidden])
Date: 2020-10-01 12:31:52

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.


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups