Talk type: Talk

Concepts: simplifying implementation of std utility classes

  • Talk in Russian

Concepts appearing in C++20 have for a long time been the subject of a wide discussion. Despite lots of information accumulated through the years (including speeches given by world-class experts), among the application developers (those who do not fall asleep cuddling up to the standard every night) there still isn't clear understanding on what exactly C++20 concepts are and do we really need them when we've got good old enable_if. Part of the blame is on concepts' evolution in 15 years (Concepts Full + Concept Map -> Concepts Lite), and part is on their dissimilarity to the corresponding tools in other languages (Java/С# generic bounds, Rust traits, ...).

This talk will begin with a brief overview of concept-related changes in C++20. Then we'll explore implementation of several STL classes and functions, comparing C++17 и С++20 solutions. For example:

  • to implement std::optional, today we have to use inheritance hierarchy with a depth of 7. In C++20, there will be no need for that;
  • for the default constructor std::pair today two template functions are required, in C++20 — one non-template;
  • template classes often have partial specialization; if template parameters have some special properties, it is easier and more correct to use concepts.

The audience is expected to have basic understanding of concepts and SFINAE. Knowledge of C++ standard library will also be useful, but you don't need to know all the implementation intricacies and details.

  • #metaprogramming

Speakers

Talks