Type-generic expression
From cppreference.com
Implements a form of type-polymorphism mechanism.
Contents |
[edit] Syntax
_Generic ( assignment-expression ,
|
|||||||||
[edit] Explanation
The first assignment-expression is the controlling expression and determines the result of the generic selection. If the type of the controlling expression is compatible with one of the type-namei, then the result of the generic selection is the value of the assignment-expressioni in the generic association. Otherwise, the result expression of the generic selection is the expression in the default generic association. If a generic selection has no default generic association, then the type of the controlling expression must be compatible with exactly one of the types named in its generic association list.