Constraints in the first template parameter
02:46 28 Nov 2025
  1. Why can't we put a constraint on the first type parameter of the concept?

  2. Why can't we use the short form of the concept for non-type parameter?

  3. Why is it possible to specialize concepts only in this way?

#include 

// 1)
  template // OK
concept C1_ = std::integral<_T>;
//  template // ERROR: a concept cannot be constrained
//concept C1_ = true;
  template // OK
concept C2_ = true;

// 2)
  template requires C1_<_C1> // OK
struct S11 {};
  template // OK
struct S12 {};
  template requires C2_<_c2> // OK
struct S21 {};
//  template // ERROR
//struct S22 {};

// 3)
// OK:
  template
auto constexpr v_ = false;
  template
auto constexpr v_<_v> = true;
  template
concept V_ = v_<_v>;
// ERROR:
//  template
//concept V_ = false;
//  template
//concept V_<_v> = true;
c++ templates c++-concepts specialization