Introduction

Let’s get an overview of using concepts with C++ classes.

Recap

In the previous chapter, we learned to use concepts with function templates and now we’ll use them with class templates. We learned there are four ways to use concepts:

  • The requires clause
  • The trailing requires clause
  • Constrained template parameters
  • Abbreviated function templates

With classes, we can’t use the abbreviated function template form because this form is only for templates.

We could try to do it, but we’ll get a compile-time error, as shown below.

Get hands-on with 1400+ tech skills courses.