Jonathan Boccara's blog

Trailing Return Types

Published April 16, 2021 - 0 Comments

This article is NWH, standing for Not Written Here. The concept of NWH is inspired from the NIH (Not Invented Here) syndrome which consists in refraining from using existing code from outside the company and reinventing the wheel every time. Just like it is good practice to look out for solutions developed elsewhere, we’re going […]

What auto&& means

Published April 2, 2021 - 0 Comments

Since C++11, we have a && in the language, and it can take some time to understand its meaning and all the consequences this can have on your code. We’ve been through a detailed explanation of lvalues, rvalues and their references, which covers a lot of ground on this topic. But there is one aspect […]

“Can’t” Is No Word for Software Developers

Published March 26, 2021 - 0 Comments

When I write those words, I’ve been working 9 years in software development. Those years have taught me technical stuff, but also a few things that are not about code itself but that leads to good code, and to more. Those non-technical things aren’t taught at school or in C++ books. Nevertheless, I consider them […]

What C++ Fold Expressions Can Bring to Your Code

Published March 19, 2021 - 0 Comments

In the previous post we saw how fold expressions work. We saw how to define them, how to control their associativity, and how to handle empty variadic packs in a fold expression. But all along we’ve been using an example that didn’t bring much value to code: a function that makes the sum of its parameters: template<typename… […]

C++ Fold Expressions 101

Published March 12, 2021 - 0 Comments

C++17 brought fold expressions to the language. This interesting feature allows to write expressive code, that almost seems magical. Here is a two-posts recap on how fold expressions work (this post) and how they can improve your code (the next post). Fold expressions A fold expression is an instruction for the compiler to repeat the […]

std::index_sequence and its Improvement in C++20

Published March 5, 2021 - 0 Comments

It would be great if we could iterate on the values of a std::tuple like we do for a std::vector or for other STL containers. But we can’t. To iterate on the values inside of a tuple, we need to proceed in two steps: instantiate a std::index_sequence object with std::make_index_sequence, pass it to another function that performs the […]

C++ Concepts: More than Syntactic Requirements

Published February 26, 2021 - 0 Comments

After years and years of expectation, concepts have finally made it in C++20. Concepts are descriptions in code of a set of expressions that must be valid with a given type. Those are syntactic requirements. But there is more to concepts than that: concepts also have semantic requirements. Before getting into that, here is a […]

A Recap on string_view

Published February 19, 2021 - 0 Comments

The string capabilities of C++ have little evolved since C++98, until C++17 brought a major evolution: std::string_view. Let’s look at what string_view is about and what it can bring to your code, by making it more expressive and making it run faster. std::string_view As its name suggests, std::string_view is a view on a string. But let’s define […]

1 3 4 5 6 7 45