Use-cases for Concepts

Discover use-cases of concepts in C++20.

First and foremost, concepts are compile-time predicates. A compile-time predicate is a function that is executed at compile-time and returns a boolean.

Before I dive into the various use-cases of concepts, I want to demystify concepts and present them simply as functions returning a boolean at compile time.

Compile-time predicates

A concept can be used in a control structure, which is executed at run time or compile-time. Run the code below.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy