Namespaces
Variants

std::meta::is_annotation

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
Defined in header <meta>
consteval bool is_annotation( std::meta::info r );
(since C++26)

Returns true if r represents an annotation. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents an annotation; otherwise false.

Example

#include <meta>

[[=1]] int x;

static_assert(!is_annotation(^^x));

constexpr std::meta::info ann{std::meta::annotations_of(^^x)[0]};

static_assert(is_annotation(ann) and [:::std::meta::constant_of(ann):] == 1);

int main() {}

See also

obtains the annotations applying to the reflected entity
(function) [edit]
obtains the annotations that apply to the reflected entity and have the specified type
(function) [edit]