Loading…
CppCon 2019 has ended
Back To Schedule
Monday, September 16 • 16:45 - 17:45
Concepts in C++20: Revolution or Evolution

Log in to save this to your schedule, view media, leave feedback and see who's attending!

The key idea of generic programming with templates is it to define functions and classes which
can be used with various types. Often it happens that you instantiate a template with the wrong
type. The result is typically a few pages of cryptic error messages. This sad story ends with
concepts. Concepts empower you to write requirements for your templates which can be
checked by the compiler. Concepts revolutionise the way, we think about and write generic
code. Here is why:

* Requirements for templates are part of the interface.

* The overloading of functions or specialisation of class templates can be based on concepts.

* We get improved error message because the compiler compares the requirements of the template parameter with the actual template arguments.

However, this is not the end of the story.

* You can use predefined concepts or define your own.

* The usage of auto and concepts is unified. Instead of auto, you can use a concept.

* If a function declaration uses a concept, it automatically becomes a function template. Writing function templates is, therefore, as easy as writing a function.

Speakers
avatar for Rainer Grimm

Rainer Grimm

C++ trainer, Modernes C++
I've worked as a software architect, team lead, and instructor since 1999. In 2002, I created company-intern meetings for further education. I have given training courses since 2002. My first tutorials were about proprietary management software, but I began teaching Python and C... Read More →


Monday September 16, 2019 16:45 - 17:45 MDT
Aurora D
  • Future of C++