Every once in a while we all face that problem: how to output strings separated by commas (or by any other character), and not have a comma appear after the last one? Or rather: how to avoid writing a comma after the last string AND keep the code clean of the annoying bookkeeping that this […]
Curried objects are like facilitators. They consist in intermediary objects between a caller and a callee, and helps them talk to each other in a smooth way. This ability makes the code simpler and easier to read. While having seen and used the pattern at various places, the first time I encountered the actual term […]
Writing expressive code is putting together code that conveys our intents, for other people to understand them. And the thing with code is that it tends to lasts. So what you write today in your codebase is like a letter that you address to people living in the future. Those people include all the developers […]
Today’s post is written by Louis-Charles Caron. Louis-Charles is a software engineer at Advanced Silicon, working on image processing for low latency human-machine interaction. Fan of coding, Louis-Charles enjoys programming in Python and C++ and likes to design tools to build faster, more intuitive software. He dived into multi-threading a couple of years ago and […]
Now that we’re clear on the Compiler-generated Functions, the Rule of Three and the Rule of Five, let’s put this to use to reflect on how to use the “= default” feature to have expressive and correct code. Indeed, C++11 added the possibility to require from the compiler that it write a default implementation for […]
When you read a class interface that defines some basic functions (constructors, destructors, assignment) but not all of them, don’t you wonder what that code means, and what functions will be available for that class in practice? I often do. To clarify this type of situation, I suggest we make a recap of what class […]
Today’s guest post is written by Vincent Zalzal. Vincent is a software developer working in the computer vision industry for the last 13 years. He appreciates all the levels of complexity involved in software development, from how to optimize memory cache accesses to devising algorithms and heuristics to solve complex applications, all the way to […]
Today’s post is written by Henrik Sjöström . Henrik is currently working at Starcounter building an SQL queryprocessor. He enjoys working on algorithmically complex issues and prioritises expressive code so the actual problem is visible rather than hidden by hard to follow code. Making a class comparable is usually something of a chore. In C++20 […]
Today’s guest post is written by Till Heinzel. Till is a physicist-turned-software developer at Luxion Aps in Denmark, who is very interested in expressive C++ and the growth of the language in a more expressive direction. Till can be found online on LinkedIn. First off, I would like to thank Jonathan for creating FluentCpp and […]
How to apply a function to each of the parameter of another function? For example, consider the following function: template<typename… Args> void g(Args&&… args) { // … } How can we apply a function f to each of the parameters of g? Mixing the code of f with the mechanics of going over all the arguments passed […]