Jonathan Boccara's blog

A new post every Tuesday and Friday morning

Using Strong Types to Return Multiple Values

Published November 10, 2017 - 14 Comments

We’ve seen how strong types helped clarifying function interfaces by being explicit about what input parameters the function expected. Now let’s examine how strong types help clarifying functions that return several outputs. We’ll start by describing the various ways to return several outputs from a function in C++, and then see how strong types offer an […]

Calling Functions and Methods on Strong Types

Published November 7, 2017 - 7 Comments
Functions methods strong types C++

Strong types are a way to put names over data in code in order to clarify your intentions, and the more I work on it the more I realize how deep a topic that is. So far we’ve seen the following subjects in our series on strong types: Strongly typed constructors Strong types for strong interfaces […]

How Unit Tests Help Express Your Code’s Intent

Published November 3, 2017 - 2 Comments
unit test intentions

Guest writer Tim Scott talks to us about how to make unit tests express the intentions of a piece of code. Tim is a software developer and tester passionate about software quality and automation. You can find him online on, his blog about increasing quality and developer efficiency through automation, or on his Twitter or […]

Function Aliases In C++

Published October 27, 2017 - 4 Comments

One thing that dramatically improves the expressiveness of a piece of code is respecting its levels of abstractions. It sometimes involves massive refactorings, but in many cases it just comes down to choosing good names in your code. Picking a name that is consistent with the abstraction level of the surrounding code can make a […]

The Results of the Expressive C++17 Coding Challenge

Published October 23, 2017 - 14 Comments
Expressive C++17 coding challenge

The Expressive C++17 coding challenge has come to an end after being open for three weeks, for submissions of the clearest code using C++17. It was a joint challenge between Bartek’s coding blog and Fluent C++, and its point was to learn collectively how to use C++17 to write clearer code. We’ll see the winner and […]

(std::)Accumulate Knowledge On STL Algorithms

Published October 17, 2017 - 0 Comments

If there’s one algorithm that lets you do all sorts of things, that must be std::accumulate. It is important to know how to use it, and also how not to use it. This post is part of the STL Learning Resource. Basic usage Numeric types The first thing to know about std::accumulate is its location: the […]

Size and Capacity of STL Containers

Published October 13, 2017 - 0 Comments

Size and capacity are concepts that look somewhat similar from afar. But mixing them up can lead to under-optimized or even plain wrong code. This article explains all about size and capacity of standard containers, and how these two concepts differ. A big thanks to  Stephan T. Lavavej, who kindly provided his feedback on the […]

Partitioning with the STL

Published October 10, 2017 - 2 Comments
partition STL

Partitioning a collection consists in reordering it so that the elements that satisfy a given predicate are moved up to the beginning, and those that don’t satisfy it are moved down after them. The first element that does not satisfy the predicate is called the partition point. This is also the end of the subrange of elements […]