C++ Logo

std-proposals

Advanced search

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

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Sat, 3 Oct 2020 19:03:17 +0200
Il 03/10/20 17:46, Jason McKesson via Std-Proposals ha scritto:
> And they can do the exact same thing with the `enumerate` view
> version. We already have the tool in our toolbelt, so why do we need a
> very slightly shorter version of it?

Is it really "slightly shorter"? At least as a mental exercise, getting
an index shouldn't require creating a zipped view of elements and
indices, applying a projection to get just the element, applying a
predicate to that projection, find the first that matches, extract the
index from the pair and return it (plus figuring out how to signal "not
found")...

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

Received on 2020-10-03 12:03:27