Posts

Showing posts from November, 2021

Overview of C++20: Concepts

Image
Posts in "Overview of C++20" Ranges Concepts TBA: ... 📌 Disclaimers : The idea of this overview is self-education. Please consider this article as my notes during learning C++20. The main goal - keep it simple and short. At least try to do it. ❗ There is no guarantee that below theoretical and practical parts are correkt and up-to-date. Introduction C++20 introduces concepts as a way to write powerful and self-documenting templates. Concepts are all about putting the right level of constraints onto the operating types. They constrain what types your template can match, and check that at compile time. The syntax for defining a concept is: Previously, you could use tag dispatching ; if constexpr ; SFINAE or static_assert to achieve more or less the same behaviour as with concepts. In the next section we will start considering some of these techniques before diving into the