If you want to become proficient at manipulating collections in C++, you have to know your STL algorithms. And in particular, you have to know your STL algorithms on sets. The algorithms on sets are less famous than the classical std::for_each or std::accumulate algorithms but they are just as useful, if not more. The algorithms on sets include […]
[A Russian translation of this article is available on howtorecover.me – courtesy of Vlad Brown] A derived class sometimes needs to call the code of its base class and name it explicitly. But for bases classes with a long name, repeating it in the body of the derived class adds a lot of clutter to […]
On Fluent C++, we talk a lot about topics related to expressive code: writing expressive code, making existing code more expressive, and how to keep our motivation up and improve even when facing code that is not expressive. But WHY do we do this? Why is expressive code the main technical characteristic of code we […]
(this post is daily-able but you’ll need to split its independant parts across several days) Building strings sounds like one of the most basic things a programmer can do in any language. But in fact there is a lot of ways to go about it in C++, depending on how complex your need is. Here we […]
Getting naming right is crucial to convey your intentions through code. Indeed, the compiler doesn’t care if your names are clear enough. It is just for the people who work with you. And that includes you. The clarity of the names in a piece of code has a strong impact on how easy it is […]
Now that we’re clear on how the CRTP works, let me share with you another technique involving templates that is complementary to the CRTP: Mixin classes. I learnt about mixin classes by watching Arthur O’Dwyer’s Template Normal Programming talk at CppCon (actually you can find them in the slides because they were skipped over during the presentation). I find […]
A function takes input and produces outputs. Simple, right? If so, how come that a lot of functions in C++ code don’t look that way? And how to overcome those difficulties to make them look like proper functions and show a clear interface? This is the subject of this week’s video: Don’t want to miss […]
Have you ever used std::inserter to insert the outputs of an STL algorithm into a sorted container such as an std::set? And if you have, weren’t you annoyed by how its interface forces you to specify the position to insert the elements in the set? I find this very annoying, because most of the time we have […]
Naming is such an important topic to translate our intentions into code. But are there names that we should never see in code? This is what I discuss in this week’s video: Don’t want to miss out ? Follow:   Share this post!
Some of the algorithms of the STL have a structure in common: they take one or more ranges in input, do something more or less elaborate with them, and produce an output in a destination range. For example, std::copy merely copies the inputs to the outputs, std::transform applies a function onto the inputs and sends the results […]