How to Retrieve the Firsts from a Collection of Pairs

Simple.

How to Retrieve the Firsts from a Collection of Pairs

by Jonathan Boccara

From the article:

When using the STL, there is a use case that pops up every now and then and that often causes more trouble than necessary: if we have a collection of pairs, like an std::vector of pairs, or simply a std::map, how can we retrieve the collection of the first elements of each item in the collection?

Add a Comment

Comments are closed.

Comments (1)

0 0

NoSenseEtAl said on Nov 12, 2018 03:23 PM:

Sharing articles with code that uses std::back_inserter should be punishable by writing Javascript. wink

Beside that good article.