Today’s guest post is written by Federico Kircheis, a (mainly C++) developer in Berlin, always looking for how to improve himself, and finding interesting problems to solve. Federico is the author of the article on Function poisoning in C++ on Fluent C++. In today’s article, he goes further and shows us how to delete functions […]
Today’s post is written by guest author Damien Beaufils. Damien is a passionate developer and a software crafter. Convinced that well-designed software is at least as important as working software, he works as a Tech Lead in agile projects, or as a trainer on software development practices such as Test Driven Development. You can find […]
C++11’s feature auto has changed the looks of C++ code. In a lot of cases, auto alleviates code from burdening information, and using it does make code simpler. So much so that using auto becomes a second nature to make code more expressive. Should we use auto always? According to Herb Sutter guideline for C++11, yes, almost […]
For loops have evolved over the years, starting from the C-style iterations to reach the range-based for loops introduced in C++11. But the later, modern, versions of the for loop have lost a feature along the way: the possibility to access the index of the current element in the loop. Indeed, consider this rather […]
Here is a new episode in the series of word counting! Today we will focus on computing the span words in code. As a reminder, word counting consists in counting the occurrences of every term in a piece of code (for example, in a function), and sorting the results by most frequent words. This can reveal […]
In our first step implementing a word counter in C++, we wrote code that could extract the words inside of a piece of code. In the second step, we changed that code so that it extracted individual words inside of camelCaseSymbols (and also of PascalCaseSymbols), losing the previous feature of counting entire words. Today, we […]
Word counts can reveal information about your code, or make an unknown piece of code more expressive to your eyes. There are online tools to count words in generic text, but most of those I’ve come across are designed around counting words in text and SEO (Search Engine Optimization). Since analysing source code is not the […]
Being able to read code and understand it quickly is an invaluable skill for a software developer. We spend way more time reading code that writing it, and being able to make a piece of code expressive to your eyes can make you much more efficient in your daily work. There is a technique to […]
An object of type optional<T> can take every value that T can take, plus one. This extra value represents an object that is “null” (or “empty” or “not set”, formulate it as you will). And we’ve already seen how optionals can make your interfaces clearer. The aspect I’d like to dig in deeper today is the particular […]
In C++, one can manipulate objects directly or via something else, which is commonly called a handle. At the beginning of C++, handles could be pointers, references and iterators. Modern C++ brought in reference wrappers, and boost introduced optional references. The fact that a given piece of code chooses to use one particular handle expresses something. For this […]