DEV Community

Sandor Dargo
Sandor Dargo

Posted on


The big STL Algorithms tutorial: Introduction

I've already written quite a few articles about features introduced by C++ 11 and how much it changed how I look at the language. The feature I liked the most is probably the one of lambda expressions. I don't like them for their sheer existence, it's not l'art pour l'art, but it really helps using the different STL algorithms. If you want to get a quick introduction to all the 105, have a look at this video by the owner of

How I write C++ code changed a lot due to the combination of lambdas and STL algorithms. Yet I know that I don't a lot and I want to improve my knowledge on the STL. What's the best way to learn? Either by doing it or by teaching it. I'm already doing it, so is why hereby I'm starting to write a series on the STL algorithms.

I don't know yet, how frequently I'll write about them and how many I'll cover in one article, but every second technical article I'll write will be about the STL algorithms - the order of publication is another question.

Let's get started!

The algorithms we are going to discuss are basically a set of functions that we can use well together with STL containers and another common point is that they all can be found in the header.

According to, we can categorize them into 8 groups plus others:

  • Non-modifying sequence operations (e.g. all_if, any_of, find)
  • Modifying sequence operations (e.g. copy, copy_if, transform)
  • Partitions (e.g. partition, is_partition)
  • Sorting (e.g.sort, is_sorted)
  • Binary search (e.g. binary_search, lower_bound, upper_bound)
  • Merge (e.g. merge, set_union)
  • Heap (e.g. push_heap, pop_heap)
  • Min/max (e.g.min, max...)
  • Others

Some groups I'll show you in one post, like min/max, but some other groups which are way bigger, like Non-modifying sequence operations I'll break down into smaller chunks.

Stay tuned!

This article has been originally published on my blog.

Top comments (4)

kitarp29 profile image
Pratik Singh

Thank You Sir for this Amazing thread of Articles😍😍πŸ”₯

sandordargo profile image
Sandor Dargo

Thanks a lot for your kind words, Pratik!

codemouse92 profile image
Jason C. McDonald

Super excited to see where this series goes!

Confirmation on "learning by teaching." My Python skills have grown exponentially just through writing my "Dead Simple Python" series.

sandordargo profile image
Sandor Dargo

Thanks for your comment!

We are at about 1/4th and we have a lot to go. For months, I've been on the following schedule. 1st week: technical post. 2nd week: some softer topic. 3rd week: book review. So it's still at least a year to get to the end.

And indeed, I've already learned a lot. And that was one of my main goals. To understand these functions better and if I can help others doing so, it's even better.

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<