C++ Logo


Advanced search

Subject: Re: [std-proposals] Finding the index of an element (std::find_first_index)
From: Dvir Yitzchaki (dvirtz_at_[hidden])
Date: 2020-10-01 14:21:54

with [P2164
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2164r2.pdf>] this
can be expressed as

  auto [index, it] = ranges::find_if(range | views::enumerate, pred);

On Thu, 1 Oct 2020 at 20:32, Matthew Woehlke via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> 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
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

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

Standard Proposals Archives on Google Groups