C++ offers great performance and many powerful features like the standard library, a rich type system, and compile-time programming. However, it often ends up being hard to read. High-level languages like C++ are usually not written to communicate with compilers. They’re usually written to communicate with people. In fact, many developers spend more time reading and understanding other people's code than writing their own.
This talk focuses on how to optimise C++ code for being easily readable by average human developers, ideally being close to plain English. I will revisit best practices on naming, comments, and locality from a modern C++ perspective. Readability also means writing less code and avoiding repetitions and unnecessary noise. I will present practical use cases of modern C++ features that are especially effective to achieve this. I will finish the talk with an overview of new C++17 features aiming at more readable code, such as fold expressions, constexpr-if, and structured bindings.
Instances management and propagation is challenging.
They involve multiple combined patterns and requires us to keep track of the code managing creation and reclamation of such resources.
Chained references are complex to maintain, update, swap, steal, reclaim.
These operation often require traversals incurring performance penalty.
From abstract to real world example I will present the sync_ptr object I implemented to ease these operation, make them faster, safer.
For those eager to know more, here is the GitHub repo: https://github.com/romaincheminade/sync_ptr