Defining Concepts with requires
Define custom concepts using requires expressions and constraints.
The concept Keyword
Declare a concept with template <params> concept Name = expression; The expression must be a compile-time boolean.
template <typename T>
concept Integer = std::is_integral_v<T>;Combining Type Traits
Use logical operators to combine traits into a concept.
template <typename T>
concept SignedInteger = std::is_integral_v<T> && std::is_signed_v<T>;All lessons in this course
- Why Concepts vs SFINAE
- Defining Concepts with requires
- Using Concepts in Templates and auto
- Common Standard Concepts Integral Ranges