Articles & Books

Reversing words of a string with ranges--Marco Arena

A new interpretation of a classical problem:

Reversing words of a string with ranges

by Marco Arena

From the article:

In this post I share the story of a “C++ aha-moment”, hence I use the hashtag #thatsarotate (resumed last Saturday at the Italian C++ Conference 2021 to honor our keynote speaker Sean Parent). Why not sharing your own stories of “C++ aha-moments” adding the same hashtag to your tweets, posts, or whatever? It would be really appreciated...

7 Top Tips for Debugging C++ -- Greg Law

In this guest blog post, Greg will share a few top tips for debugging C++ code.

7 Top Tips for Debugging C++

by Greg Law

From the article:

Debugging is central to programming – you cannot be a great programmer without being great at debugging. Hopefully, my favorite C++ debugging tips will help you be as clever and productive debugging your code as you are writing it in the first place.

  • #1 Have a full kit of debugging tools
  • #2 Conditional breakpoints
  • #3 Watchpoints
  • #4 User-defined debugging commands in Python
  • #5 Pretty-print structures
  • #6 Time Travel Debugging
  • #7 Command find to search for a byte sequence

Transrangers: An Efficient, Composable Design Pattern for Range Processing -- Joaquín M López Muñoz

Another twist on ranges.

Transrangers: An Efficient, Composable Design Pattern for Range Processing

by Joaquín M López Muñoz

From the article:

Transrangers are a new design pattern for efficient, composable range processing that can be faster than pull-based C++/Range-v3 views whithout losing any expressiveness. The underlying architecture combines ideas from push processing with the internalization of control flow. Transrangers can be used on their own or be leveraged as an implementation detail of range libraries to improve the performance of view-based operations.

 

Painless C++ Coroutines--Gajendra Gulgulia

Another introduction.

Painless C++ Coroutines-Part 1

Painless C++ Coroutines-Part 2

Painless C++ Coroutines-Part 3

Painless C++ Coroutines-Part 4

Painless C++ Coroutines-Part 5

by Gajendra Gulgulia

From the article:

Incidentally I found the mechanics of coroutines quite obfuscating given the number of implicit and under-the-hood calls to several methods associated with coroutine and their return type objects. Even with tons of articles and posts on the web, I started to have a feeling that coroutines is an arcane feature that can be understood by the very few who are either in committee or are renowned authors of blogs, books and articles or experienced C++ library authors.
But after a month of arduous efforts and experiments, trials and errors to understand coroutine, I decided to write a tutorial series that can be used by any intermediate C++ developer to understand coroutine and in the effort I made sure that this article is the last that anyone should refer to, to learn, understand and demystify coroutines without being a super experienced C++ library author. If you’re impatient to get started, then directly jump to section 1: What are coroutines? Else read the Introduction section to get detailed highlight of the tutorial series...

Template Arguments--Rainer Grimm

The series continue.

Template Arguments

by Rainer Grimm

From the article:

It is quite interesting how the compiler deduces the types for the template arguments. To make it short, you get most of the time the type you expect. The rules do not only apply to function templates (C++98) but also to auto (C++11), to class templates (C++17), and concepts (C++20)...

7 Top Tips for Debugging C++--Greg Law

How do you do it?

7 Top Tips for Debugging C++

by Greg Law

From the article:

Brian Kernighan famously said, “Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?”. For me, this doesn’t just mean “keep it simple.” It also means debugging is central to programming – you cannot be a great programmer without being great at debugging. Hopefully, my favorite C++ debugging tips will help you be as clever and productive debugging your code as you are writing it in the first place...

Decent concepts--Andrzej Krzemieński

Are you using concepts?

Decent concepts

by Andrzej Krzemieński

From the article:

Last year I published two posts on writing concepts:

  1. Concept Archetypes,
  2. Semantic requirements in concepts.

Having had some time to reflect upon these posts, I now realize that the model presented in them is not complete. In this post I want to give a more coherent view of concepts...

A list of bad practices commonly seen in industrial projects-- Thomas Lourseyre

Are you in such an environement?

A list of bad practices commonly seen in industrial projects

by Thomas Lourseyre

From the article:

If you ever worked in a company-size software project (with numerous developers), there is a good chance that the codebase was, at least, pretty messy.

In these days, most industrial C++ developers are not experts. You will often work with developers with a Java or Python background, people who just learnt C++ at school and don’t really care that much about the language and old developers who code in “C with classes” instead of C++.

Having worked on a few industrial projects myself, I realized there are some recurring patterns and bad practices. If you happen to teach your coworkers to avoid these bad practices, you will all take a huge step toward a beautiful codebase and it will be beneficial to you, your coworkers and your project.

Here is a non-exhaustive list of these common bad practices...