From cppreference.com
Attach information to declarations in a way that reflection can observe.
Syntax
The list of annotations is introduced in an
. Each annotation starts with =.
=constant-expressionExplanation
An annotation may be applied to any declaration of a type, type alias, variable, function, function parameter of non-void type, namespace, enumerator,
, or non-static data member.
Let E be std::meta::reflect_constant(expr) (where expr is the constant-expression), E must be a
. The result of E can be observed by calling std::meta::constant_of on the reflection of the annotation.
Annotations are always distinct from one another, even if they have equivalent values and are applied to the same declaration.
[[=42,=42]]intx;static_assert(std::meta::annotations_of(^^x).size()==2);[[=42]]intf();[[=24]]intf();static_assert(std::meta::annotations_of(^^f).size()==2);Substituting into an annotation is not an
.
Example
See also