Constraint Symbols (CC Mode Manual)

Next: , Previous: , Up: Syntactic Symbols [Contents][Index]


10.2.12 C++ Constraint Symbols

The C++20 standard introduced the notion of concepts and requirements, a typical instance of which looks something like this:

 1: template <typename T>
 2: requires
 3: requires (T t) {
 4: { ++t; }
 5: }
 6: && std::is_integral<T>
 7: int foo();

Line 1 is assigned the familiar topmost-intro. Line 2 gets topmost-intro-cont, being the keyword which introduces a requires clause. Lines 3, 6, and 7 are assigned the syntax constraint-cont, being continuations of the requires clause started on line 2. Lines 4 and 5 get the syntaxes defun-block-intro and defun-close, being analyzed as though part of a function.

Note that the requires on Line 3 begins a requires expression, not a requires clause, hence its components are not assigned constraint-cont. See https://en.cppreference.com/w/cpp/language/requires.

AltStyle によって変換されたページ (->オリジナル) /