Using Concepts in Templates and auto
Constrain function templates and abbreviated function templates with concepts.
Three Syntaxes Recap
You can apply a concept three ways: as a template parameter prefix, as a requires clause, or with abbreviated function template syntax.
Prefix Syntax
Replace typename with the concept name.
template <std::integral T>
T add(T a, T b) { return a + b; }All lessons in this course
- Why Concepts vs SFINAE
- Defining Concepts with requires
- Using Concepts in Templates and auto
- Common Standard Concepts Integral Ranges