Jonathan Boccara's blog

How std::any Works

Published February 5, 2021 - 0 Comments

In the previous post we’ve seen a very nice technique to use value semantics with inheritance and virtual methods, which was made possible by std::any. Given its usefulness, it would be interesting to better understand std::any. Indeed, std::any is sometimes said to be “the modern void*“. But it does much more than a void*. A […]

Inheritance Without Pointers

Published January 29, 2021 - 0 Comments

Inheritance is a useful but controversial technique in C++. There is even a famous talk by Sean Parent called Inheritance is the base class of evil. So inheritance is not the most popular feature of the C++ community. Nevertheless, inheritance is useful, and widely used by C++ developers. What is the problem of inheritance? It […]

4 Features of Boost HOF That Will Make Your Code Simpler

Published January 15, 2021 - 0 Comments

Boost HOF, standing for Higher Order Functions, is a Boost library offering functions that work on functions. This impressive library provides a lot of advanced components allowing to go a step further into functional programming in C++. In this post, we’ll focus on 4 of the more basic ones (+ a bonus one) that allow […]

Infix Function Calls with Boost HOF

Published January 8, 2021 - 0 Comments

In C++, functions are called with a prefix syntax. This means that at call site, the function name is before the parameters: myFunction(parameter1, parameter2); ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ function parameters On the other hand, binary operators such as operator+ are called with an infix syntax, which means that the operator is between the parameters: parameter1 + parameter2 Some […]

Include What You Use

Published January 1, 2021 - 0 Comments

I’ve used the clang based include-what-you-use tool on a fairly large chunk of code — a couple of hundreds of files, containing dozens of includes each. That was an interesting experiment. Here are my takeaways on this powerful tool, what it can bring to your code, and a few things I wish I had known […]

Fluent C++ is 4 Years Old

Published December 25, 2020 - 0 Comments

Fluent C++ has turned 4 a couple of weeks ago. There was so much going on on the site that we didn’t take the time to celebrate. Let’s take advantage of the Christmas holiday to celebrate this 4 years birthday and take a look at the traditional highlights of the past year on Fluent C++. Thank […]

On Design Patterns in C++

Published December 18, 2020 - 0 Comments

Design patterns are a must-know in programming today. The first reference to “design patterns” I know of is the famous GoF book: This book is a classic of programming and sits on the desk of many programmers across the world. The Design patterns described in this book are various ways to structure code to solve […]

A Classic Compilation Error with Dependent Types

Published December 11, 2020 - 0 Comments

There is a compilation error that occurs often when writing template code that uses dependent types. If you know what’s going on, it is easy to fix it immediately. But if you don’t, you can spend a while staring a what looks like reasonable code, and wondering why the complier won’t have it. I’ve been […]

Auto for Types, but Not for Concepts

Published December 4, 2020 - 0 Comments

AAA. Three letters that the C++ community associates to the early times of Modern C++. AAA. Almost Always Auto. Is this still valid today, now that C++20 is the latest standard? Exploring the reasons behind the AAA guideline allow to better understand auto and what it can express in our code. Especially since the guideline […]

1 4 5 6 7 8 45