In my previous post, I wrote about the support for C++20 modules in Visual Studio 2019 16.5. VC++ is not the only major compiler that has experimental support for modules. Clang has its own implementation, although only partial. In this post, I will discuss the support available in Clang 11. You can check the current status here.
Modules are one of the bigest changes in C++20 but the compilers’ support for them is a work in progress. The Visual C++ compiler has experimental support for modules that can be enabled by using the /experimental:module and /std:c++latest switches. In this post, I will walk through the core of the functionality available in Visual…
C++11 provides the atomic operations library that features classes and functions that enable us to perform atomic operations using lock-free mechanisms. There are primarily two class templates in this library, std::atomic and std::atomic_flag. The latter, which defines an atomic boolean type, is guaranteed to always be lock-free and is implemented using the lock-free atomic CPU instructions. The former however, may actually be implemented using mutexes or other locking operations. In this article, we will look at a new class template, introduced in C++20, std::atomic_ref.
This article has been updated for the version of WebView2 that requires Microsoft Edge WebView2 Runtime 88.0.705.50 or newer. In the previous article, we learned how to create a web view and display web content in a Windows desktop application. In this third article of the series, we will look in detail at navigation and…
In the second part of this series, we will see how to use the WebView2 control in a C++ Windows desktop application. We will use a single document interface MFC application that features a toolbar where you can specify an address to navigate to and buttons to navigate back and forward as well as reloading the current page or stopping navigation.
Earlier this month, Microsoft has released the new version of its Edge browser, based on the Chromium project. The new browser works on Windows 10, Windows 8.x, and Windows 7, as well as macOS, iOS, and Android. If your application display web content, you can use the new Edge browser as the rendering engine. This is made possible through the Microsoft Edge WebView2 control, currently in developer preview. In this series, I will show how you can do this in a C++ Windows desktop application.
The .NET Core framework version 3.1 was released earlier this month, alongside with Visual Studio 2019 16.4 (which you must install in order to use .NET Core 3.1). Among the changes, it includes support for C++/CLI components that can be used with .NET Core 3.x, in Visual Studio 2019 16.4. However, not everything works out of the box. In this article, I will show how you can create and consume C++/CLI components targeting .NET Core 3.1.
In some situations, we need to makes sure function templates can only be invoked with some specific types. SFINAE (that stands for Substitution Failure Is Not An Error) is a set of rules that specify how compilers can discard specializations from the overload resolution without causing errors. A way to achieve this is with the help of std::enable_if.
Back in mid-August, Microsoft released the 2nd preview of Visual Studio 2019 16.3. This is the first version of Visual Studio to support concepts from C++20 both in the compiler and the standard library (header <concepts>) without the changes made at the ISO C++ standards meeting in Cologne. These changes are available when you compile with the /std:c++latest switch.
Concepts allow performing compile-time validation of template arguments and function dispatch based on properties of types. Concepts are very useful in libraries where they can be used to impose compile-time checks on the template arguments of functions or types. For instance, a generic algorithm for sorting a container would require the container type to be sortable for the program to even compile.
In this article, I will show an example with a concept that verifies that a type T can be converted to a std::string via a to_string() function, that is either a member of the class or a free function.
In the beginning, there was const. And people saw that const was good. And then the people said: let there be constexpr, and consteval, and constinit. And thus, starts this article about constant functions and variables in C++20, which I will try to keep short and concise.