STL Algorithms on Sets

Published December 29, 2017

If you want to become proficient at manipulating collections in C++, you have to know your STL algorithms. And in particular, you have to know your STL algorithms on sets

The algorithms on sets are less famous than the classical std::for_each
or std::accumulate
algorithms but they are just as useful, if not more. The algorithms on sets include for example std::set_difference
(which is my favourite STL algorithm).

In this week’s video, you’ll see the algorithms on sets that the STL offers, what we mean by a set in the first place, and an example of their usage in code.

Indeed, I’m getting more used to the filming equipment to make videos so, as many of you suggested, the videos on Fluent C++ now contain some live coding examples!

Here, we see a practical case: a collection of sorted values has been modified, and we have two versions of it: the collection as it was before and the collection as it is now, after the modification. How do we find out which values have been added? Which have been removed?

With the set algorithms, it’s a walk in the park. Have a look by yourself:

Related articles:

Share this post!&nbspDon’t want to miss out ?

Fluent C++稿源:Fluent C++ (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » STL Algorithms on Sets

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录