I introduced in my last post “Polymorphic Allocators with C++17” the theory of polymorphic allocators in C++17. Today, I will apply the theory. Before I go on, here are the essential parts of my last post: “Polymorphic Allocators with C++17“. A Short Reminder The following program uses polymorphic allocators. // polymorphicAllocator.cpp #include <array> #include <cstddef> […]
Author Archive for: admin
About Rainer Grimm
This author has not written his bio yet.
But we are proud to say that Rainer Grimm contributed 595 entries already.
Entries by Rainer Grimm
This post starts a miniseries about an almost unknown feature in C++17: polymorphic allocators. I often promised that I would write about polymorphic allocators. Today, I fulfill my promise. Since C++98, you can fine-tune memory allocation in general but also for user-defined types or containers of the standard library. For example, the containers of the […]
C++20 does not provide concrete coroutines, but C++20 provides a framework for implementing coroutines. This changes with C++23. std::generator is the first concrete coroutine. std::generator is part of the extension of the ranges library in C++23. So, let me start this post with the ranges library in C++20 and its extension in C++23. I will […]
I have given many C++20 classes in the last two years and improved my C++20 knowledge. Consequentially, I updated my C++20 book. This update includes restructured chapters, more detailed information, and additional examples. The book now has almost 700 pages and more than 200 examples. This issue is the final one. I’m done and will […]
A std::mdspan is a non-owning multidimensional view of a contiguous sequence of objects. The contiguous sequence of objects can be a plain C-array, a pointer with a size, a std::array, a std::vector, or a std::string. Often, this multidimensional view is called a multidimensional array. The number of dimensions and the size of each dimension determine […]
The four associative containers std::flat_map, std::flat_multimap, std::flat_set, and std::flat_multiset in C++23 are a drop-in replacement for the ordered associative containers std::map, std::multimap, std::set, and std::multiset. We have them for two reasons in C++23: memory consumption and performance. With C++23, we have 12 associative Containers. Twelve? Right! Now, I need a systematic and start with the […]
C++23 extends the interface of std::optional and gets the new data type std::expected for error handling. Before I dive into the extended monadic interface of std::optional in C++23, I want to introduce this C++17 type. std::optional std::optional is quite comfortable for calculations such as database queries that may have a result. This vocabulary type requires […]
The C++23 standard library has very impressive improvements. In this post, I will write about the modularized standard library and the two convenience functions std::print and std::println. The new “Hello World” Each programming challenge in a new language starts with the “Hello World” program. Since C++98, this was our starting point: #include <iostream> int main() […]
Today, I want to present a mini book written Andrey Karpov from the PVS-Studio team. This book is educational and entertaining at the same time. The mini book contains 60 terrible coding tips — and explanations of why they are terrible. It’s a lot of fun to read them. The horrible tips are not fictional […]
Today, I’m happy to present a guest post from Victor J. Duvanenko about my favorite C++17 feature: the parallel STL algorithms. Victor has published a book about “Practical Parallel Algorithms in C++ and C#“. Without further ado, here is Victor guest post: C++ includes a standard set of generic algorithms, called STL (Standard Template Library). […]