Blog 2019 01 30 The big STL Algorithms tutorial: Introduction

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.

Already published articles of this series:

Stay tuned!

This post is licensed under CC BY 4.0 by the author.