C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Finding the index of an element (std::find_first_index)
From: Giuseppe D'Angelo (giuseppe.dangelo_at_[hidden])
Date: 2020-10-03 05:51:49


Il 03/10/20 11:42, Simon Kraemer via Std-Proposals ha scritto:
> > auto i = /* insert std_find_if + distance or the proposed template to
> search in bigDynamicList. */
> > someLUT[i] = 42;
>
> Why not just use iterators as they are meant to be used?
>
> auto iter = std::find(...);
> *iter = 42;
>
> Same number of lines, no duplicate lookup.

The example uses two different containers. You find the index in one
container, and use it to index in the second. How do you use iterators
to do the same?

Thanks,

-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



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

Standard Proposals Archives on Google Groups