Jonathan Boccara's blog

“auto to stick” and Changing Your Style

Published September 28, 2018 - 19 Comments

While performing a code review on a refactoring project, I stumbled upon a change that took a line of code from this state: Widget myWidget{42}; to that: auto myWidget = Widget{42}; Well, in the actual case the type wasn’t called Widget and the initialization value wasn’t exactly 42. But that’s the gist of it. What’s […]

How to Remove Duplicates from an Associative Container in C++

Published September 25, 2018 - 10 Comments

For the third episode in our series about removing things from C++ containers, let’s tackle the tricky topic of removing duplicates from associative containers! The articles of the series are: How to Remove Elements from a Sequence Container (vector, string, deque, list) How to Remove Pointers from a Vector in C++ (co-written with Gaurav Sehgal) How […]

How to Remove Elements from an Associative Container in C++

Published September 21, 2018 - 11 Comments
remove mltimap map set multiset

Welcome back for our second part in our series on removing elements from C++ containers! How to Remove Elements from a Sequence Container (vector, string, deque, list) How to Remove Pointers from a Vector in C++ (co-written with Gaurav Sehgal) How to Remove Elements from an Associative Container (maps and sets) How to Remove Duplicates from […]

How to Remove Pointers from a Vector in C++

Published September 18, 2018 - 6 Comments

Today we have a post co-written with Gaurav Sehgal, a software engineer who works with C and C++. Gaurav can be found on his Stack Overflow profile as well as on LinkedIn. Interested in writing on Fluent C++ too? Check out our guest posting area! As we saw in the article about removing elements from […]

How to Remove Elements from a Sequence Container in C++

Published September 14, 2018 - 22 Comments

As part of the STL Learning Resource, we’re tackling today the STL algorithms that remove elements from a collection. Removing an element from a C++ collection can’t be that complicated, can it? Well, how can I put it… It has a rich complexity, let’s say. Ok, maybe it’s a little complicated. We will cover this […]

How to Write Simple Code to Accomplish Complex Tasks

Published September 11, 2018 - 5 Comments

Today’s guest post is written by guest author Miguel Raggi. Miguel is a Computer Science and Math professor at UNAM, Mexico’s largest university. He loves clean, expressive, performant C++ code (and strives to convince students to write it in this way!). Miguel is the author of discreture, an open source C++ library to efficiently generate […]

How to Deal with Values That Are Both Input and Output

Published September 7, 2018 - 9 Comments

Passing inputs and getting outputs from a function is pretty straightforward and uncontroversial: inputs get in as function arguments by const reference (or by value for primitive types), outputs get out via the return type. Output function(Input1 const& input1, int input2); Now this is all well, until input-output values get in the picture. An input-output value is […]

Function Poisoning in C++

Published September 4, 2018 - 9 Comments
function poisoning C++

Today’s guest post is written by Federico Kircheis, a (mainly C++) developer in Berlin, always looking how to improve himself, and finding interesting problems to solve. Federico talks to us about a little known compiler feature that could have an impact on how you design code: function poisoning. Also interested in writing on Fluent C++? […]

Modern C++: 7 Ways to Fake It Until You Have It

Published August 31, 2018 - 6 Comments
modern C++ fake it until you have it

Do you wish you had a later version of C++ in your production code? If you do, you’re not alone: a lot of C++ developers today don’t work with a compiler that supports the latest version of the standard. It could be for many reasons: perhaps you have a lot of legacy code to migrate, […]

Removing Duplicates in C++ CRTP Base Classes

Published August 28, 2018 - 3 Comments

At the beginning of the summer, we talked on Fluent C++ about 7 projects to get better at C++ during the summer. Reader Sergio Adán has taken up the challenge, and picked up Project #1 about how to avoid duplicates in a variadic CRTP. Today as summer is drawing to an end, Sergio shares with […]