Jonathan Boccara's blog

A new post every Tuesday and Friday morning

Strong types: inheriting the underlying type’s functionalities

Published a couple of days ago - 0 Comments

This post is part of the series on strong types: Strongly typed constructors: how to give names to several constructors with the same prototype Strong types for strong interfaces: a generalisation of the above, to make interfaces more robust Passing strong types by reference: a particular usage of strong types Strong lambdas: strong typing over generic types Good news: […]

The Curiously Recurring Template Pattern (CRTP)

Published a couple of weeks ago - 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 a couple of weeks ago - 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: how to give names […]

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

Published 3 weeks ago - 2 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 last month - 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 […]

How to split a string in C++

Published last month - 14 Comments

How to split a string in C++? That is to say, how to get a collection of substrings representing the words of a sentence, or the pieces of data contained in a CSV entry? This is a simple question, but one which has multiple answers in C++. We will see 3 solutions, each one having advantages and […]

1 2 3 6