Jonathan Boccara's blog

Strong Units Conversions

Published May 26, 2017 - 0 Comments

Strong types are a way to add a meaning to objects by giving them a meaningful name, by using types. This lets the compiler, human beings, and developers understand better the intent of a piece of code. We’ve been exploring strong types on Fluent C++. I focus here on how to define strong types conversions. If you want to catch […]

Strong types: inheriting the underlying type’s functionalities

Published May 23, 2017 - 5 Comments

This post is part of the series on strong types: Strongly typed constructors Strong types for strong interfaces Passing strong types by reference Strong lambdas: strong typing over generic types Good news: strong types are (mostly) free in C++ Inheriting functionalities from the underlying type Making strong types hashable Converting strong units to one another Metaclasses, the […]

The Curiously Recurring Template Pattern (CRTP)

Published May 12, 2017 - 11 Comments
CRTP definition curiously recurring recursive template pattern

The Curiously Recurring Template Pattern (CRTP) is a C++ idiom whose name was coined by James Coplien in 1995, in early C++ template code. The “C” in CRTP made it travel the years in the C++ community by being this: a Curiosity. We often find definitions of what CRTP is, and it is indeed an […]

Good news: strong types are (mostly) free in C++

Published May 5, 2017 - 3 Comments

Strong types are a simple and efficient tool for improving code expressiveness, by letting you express your intentions better to both the compiler and to your fellow human companions. This post is part of the series about strong types, that keeps growing because it is such a rich topic: Strongly typed constructors Strong types for strong […]

To comment or not to comment? // that is the question

Published May 2, 2017 - 4 Comments

Comments are one of these places where religion meets technology. On one side there are the firm believers that good code is commented code, and on the other side stand the devout to the scarcest commenting chapel. We can’t discuss expressive code and not talk about comments at some point. Is code expressiveness an alternative to comments, or are the […]

Move iterators: where the STL meets Move semantics

Published April 25, 2017 - 3 Comments
move iterators

In C++11, a host of new features were introduced in the language and the Standard Library, and some of them work in synergy. Move iterators are an example of how the STL collaborates with move semantics, to allow expressing several important concepts in a very well integrated piece of code. Well, almost. By using the native features only, we don’t get […]