Jonathan Boccara's blog

A new post every Tuesday and Friday morning

How to choose good names in your code

Published January 30, 2017 - 7 Comments

Naming is SO important. If your code is going to be read at least one time — if only by yourself — then names will play a major part in your capacity to work with it. Variable names, function names, class names, names in an interface, all are priceless ways to let your code tell more about […]

Searching when you have access to an STL container

Published January 26, 2017 - 0 Comments

After seeing how to search for values in a range delimited by iterators, let’s see how to operate efficiently when you directly have access to a C++ container. This is the second one in the series about searching with the STL: How to (std::)find something efficiently with the STL: covering classical STL algorithms for performing searches on ranges of […]

STL Function objects: Stateless is Stressless

Published January 23, 2017 - 4 Comments

The need for function objects arises almost as soon as you start using the STL. This post shows how to design them so that they contribute in making your code using the STL more expressive and more robust.   Function objects Here is a brief recap on function objects before getting to the meat. If […]

Making code expressive with lambdas

Published January 19, 2017 - 22 Comments

Lambdas are arguably one of the most noted addition to the language in C++11. It is a useful tool, but one has to make sure to use them correctly to make code more expressive, and not more obscure. First off, let’s make clear that lambdas do not add functionalities to the language. Everything you can do […]

How to (std::)find something efficiently with the STL

Published January 16, 2017 - 4 Comments

This series of posts aims at covering all there is to know in the STL (and even sligthly beyond) about searching. Even though the need for searching for something in a collection is quite a simple concept to comprehend, there are many things to say to cover the topic thoroughly. Even if we’ll remain focused on how to practically […]

Ranges: the STL to the Next Level

Published January 12, 2017 - 1 Comment

I first wrote this post on Simplify C++!, Arne Mertz’s blog on clean and maintainable C++. You can see the original version of this post here. As seen in a dedicated post, The C++ Standard Template Library (STL) is a fantastic tool for making code more correct and expressive. It is mainly composed of two […]

Know your algorithms: algos on sets

Published January 9, 2017 - 4 Comments

This post is part of the STL learning resource. To get the bigger picture of the STL topics that I intend to cover on Fluent C++, you can go have a look at the dedicated page at The purpose of this series of posts is to give you an opportunity to accumulate — no pun intended! — […]

The importance of knowing STL <algorithm>s

Published January 5, 2017 - 10 Comments

STL algorithms are a fantastic set of tool to improve expressiveness and correctness of your code. As outlined in Sean Parent’s famous talk C++ Seasoning the reality is quite straightforward: one needs to know his algorithms. This post explains you how STL algorithms are to be used, and what they can bring to you. Algorithms versus for loops […]

Super expressive code by Raising Levels of Abstraction

Published January 3, 2017 - 7 Comments

In this post I would like to propose a technique based on levels of abstraction to transform an obscure piece of code into expressive and elegant one. You’ve been quite a few to take up the Christmas Break Challenge for writing expressive code, by posting a comment on the challenge post or by chipping in on Reddit. […]

Can you write expressive code? – Christmas break challenge

Published December 19, 2016 - 1 Comment

Before you go away on holidays and feast on Christmas and New Year’s eve parties, I want to propose you a challenge about writing expressive code to keep your skills up during the holidays period. I’m going to show you the code for a simple task performed by an application. I’m even going to explain that code to you. […]