Jonathan Boccara's blog

Introduction to Boost Phoenix

Published January 26, 2018 - 7 Comments
Boost Phoenix

With this video, we’re starting a series about learning what’s in the Boost library. Like I discussed in Getting Inspired by Good Code, it is beneficial to know what is in Boost, either to use it or just to expand your horizons about the C++ language. And Boost can expand them pretty far. Knowing what […]

How to Be Clear About What Your Functions Return

Published January 23, 2018 - 9 Comments

What’s in a function’s interface? In most languages, a function’s interface has 3 main parts: the function’s name: it indicates what the function does, the function’s parameters: they show what the function takes as input to do its job, the function’s return type: it indicates the output of the function. ReturnType functionName(ParameterType1 parameterName1, ParameterType2 parameterName2); […]

5 Tips to Understand Legacy Code

Published January 19, 2018 - 7 Comments

Have you ever struggled to understand a codebase that was bigger than you? Most of us go through this experience more or less often in our career, and this is not a simple thing to do. Maybe you’re in this situation right now. However, even when the code isn’t expressive, there are ways to understand […]

Strong Optionals

Published January 16, 2018 - 5 Comments
Strong optionals

Both strong types and optionals are useful tools to make our interfaces more expressive. Could they be used in synergy to make one benefit from each other? The contents of this post are at an experimental stage. They are laid out here to expose a problem and a possible solution, and as a basis for […]

How is std::set_difference Implemented?

Published January 12, 2018 - 2 Comments
C++ STL set_difference

In last week video, we saw the algorithms on sets that the STL provides. We saw how you can use them to manipulate sorted collections in your code, in an expressive manner. Sean Parent said in one of his talks that we should be as familiar with STL algorithms as possible, and take this to the […]

Strong Templates

Published January 9, 2018 - 9 Comments
Strong templates

Strong typing consists in creating a new type that stands for another type and adds meaning through its name. What would it look like to apply this idea to template interfaces? Disclaimer: What you’ll see in this post is experimental, and it’d be great to have your feedback on it at the end. Strong types for […]

Making Strong Types Implicitly Convertible

Published January 5, 2018 - 0 Comments
Strong types implicit conversions

Strong types and implicit conversions, doesn’t this sound like incompatible features ? It can be argued that they are compatible, in fact. We saw why it could be useful to inherit from the underlying type’s features, and if the underlying type is implicitly convertible to something then you might want to inherit that feature too […]

7 Good Resolutions to Write Better Code This Year

Published January 1, 2018 - 1 Comment
7 Good Resolutions to Write Better Code in 2018

Four… Three… Two… One…   Such are the words that resonated across the planet during the last 24 hours (and you’ll keep hearing them all January!) So let me join my voice in and wish you the best for this new year, that it be full of exciting projects and satisfying achievements. And that you […]

STL Algorithms on Sets

Published December 29, 2017 - 2 Comments
STL algorithms sets C++

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 […]

How to Emulate The “super” Keyword In C++

Published December 26, 2017 - 11 Comments
super c++

  [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 […]