requires expressions and requires clauses in C++20

The C++20 standard added constraints and concepts to the language. This addition introduced two new keywords into the language, concept and requires. The former is used to declare a concept, while the latter is used to introduce a requires expression or a requires clause. These two could be confusion at first, so let’s take a…

Unwrapping WinUI3 for C++

The Windows UI Library 3, known shortly as WinUI 3, is a native UI framework that ships with the Windows App SDK. This is an SDK complementary to the Windows SDK, WPF, WinForms, and Win32. It provides a new unified set of APIs and tools that can be used to develop desktop apps on Windows 11 (as well as downwards to Windows 10, version 1809). I decided to have a look at what this framework provides and this post is written as I am trying it. To evaluate it, I’ll try to build a small application that does conversion between Celsius and Fahrenheit degrees as you type in a field.

New C++23 range adaptors

The C++23 standard provides several new range adaptors in the ranges library. These include join_with, zip, and zip_transform. In this post, I will briefly show how these should work.

What has the standard committee ever done for us?

Every time I see people complaining on social media about the C++ standard committee not going this or that I remember the famous scene from the movie Live of Brian when the Jews debate the benefits of the Roman occupation. However, put into the C++ world, the scene would be as follows:

Finding the second largest element in a range

In recent days, there’s been a question coming up on twitter: how do you find the second largest element in an array (container)? People are providing different answers. As usual, there are multiple solutions to this problem and they depend on the actual requirements: could this operation have side effect (change the original range) or should it be left untouched? In this post, I will discuss several solutions in C++ to this problem.

Three C++23 features for common use

C++23 is the current working version of the C++ standard. No major feature has been included so far, but a series of smaller ones as well as many defect reports have made it already to the standard. Many of these new features are small improvements or things you probably wouldn’t use on a regular basis. However, I want to point here to three C++23 features that, in my opinion, stand out among the others as more likely to be used more often.

The Evolution of Functions in Modern C++

In programming, a function is a block of code that performs a computational task. (In practice, people write functions that perform many tasks, which is not very good, but it’s a topic beyond the purpose of this article). Functions are a fundamental concept of programming languages and C++ makes no exception. In fact, in C++ there is a large variety of functions that has evolved over time. In this article, I will give a brief walkthrough of this evolution starting with C++11. Since there are many things to talk about, I will not get into too many details on these topics but will provide various links for you to follow if you want to learn more.

Use Cases of Variable Templates in C++

Since C++14 variables can also be templatized. A variable template defines a family of variable (when declared at namespace scope) or a family of static data members (when defined at class scope). The question is, what is the benefit of variable templates?

Virtual Inheritance in C++

The C++ language supports the concept of multiple inheritance. This means one class can have multiple base classes. This feature is not available in other languages, such as C# or Java. The designers of these languages didn’t considered the benefits of supporting this feature to worth the effort. And probably one of the reasons is…