Articles & Books

How we used C++20 to eliminate an entire class of runtime bugs--Cameron DaCamara

Always more powerful.

How we used C++20 to eliminate an entire class of runtime bugs

by Cameron DaCamara

From the article:

C++20 is here and has been supported in MSVC since 16.11, but today’s post is not about how you can use it, but rather how we used it to effectively eliminate an entire class of runtime bugs by hoisting a check into compile-time. Let’s get right into it!

C++20 Concurrency — Part 2: jthreads--Gajendra Gulgulia

More convenience.

C++20 Concurrency — Part 2: jthreads

by Gajendra Gulgulia

From the article:

In this part of the issue, I’ll discuss about the new std::jthread that helps us avoid the boilerplate code for joining the conventional std::thread in the first section. In the end, I’ll also mention about the std::swap algorithm’s specialization introduced in C++20 to swap the underlying thread handles associated with std::jthread ...

20 Smaller yet Handy C++20 Features--Bartlomiej Filipek

And handy they are.

20 Smaller yet Handy C++20 Features

by Bartlomiej Filipek

From the article:

C++20 is huge and filled with lots of large features. Just to mention a few: Modules, Coroutines, Concepts, Ranges, Calendar & Timezone, Formatting library.

But, as you know, that’s not all.

Depending on how we count, C++20 brought around 80 Library features and 70 language changes, so there’s a lot to cover smile

In this article, I’ll show you 20 smaller C++20 things that are very handy and good to know. Ten language elements, and ten more for the Standard Library. Most of them with a cool example.

Let’s jump right into the text!

Improving Stability with Modern C++, Part 4 — Memory Management

Smart pointers

Improving Stability with Modern C++, Part 4 — Memory Management

by Ralph Kootker

From the article

When we started learning C++, we were all taught that every new needs a corresponding delete. But sometimes we'd forget, or some code might throw an exception we weren't ready for, and then we'd leak memory. [...] With rare exceptions, C++ programmers should not have to write new or delete ever again.

Design and evolution of constexpr in C++

constexpr is one of the magic keywords in modern C++. You can use it to create code, that is then executed before the compilation process ends. This is the absolute upper limit for software performance.

Design and evolution of constexpr in C++

by Evgeny Shulgin

From the article:

The authors suffered greatly from the inability to use STL containers and wrote the std::vector and std::map analogues. Inside, these analogues have std::array that can work in constexpr. Proposal [P0784] Standard containers and constexpr studies the possibility of inputting STL containers in constexpr evaluations. Note. It's important to know what an allocator is. STL containers work with memory through it. What kind of an allocator — is specified through the tempte argument. If you want to get into the topic, read this article.

Little C++ Standard Library Utility: std::align -- Lesley Lai

An introduction of std::align with the arena allocator as motivational example

Little C++ Standard Library Utility: std::align

by Lesley Lai

From the article:

Recently, I learned about std::align, which is one of the lesser-known functions in the C++ standard library because of its limited use cases. Since it is hard to describe without a specific use case, I will use a simple implementation of an arena allocator as a motivational example.

C++20 Concepts: Part 5 (Advanced use cases)--Gajendra Gulgulia

The series continue.

C++20 Concepts: Part 5 (Advanced use cases)

by Gajendra Gulgulia

From the article:

In this article, I’ll explain and demonstrate how to define concepts that constrain multiple template parameters and more importantly how to use them in a generic function. As promised in the part 3 of the series, I’ll explain this using a function comparing for equality of two different types T and U