std::meta::is_destructor - cppreference.com
Namespaces
Variants

std::meta::is_destructor

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

Returns true if r represents a destructor. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents a destructor; otherwise false.

Example

#include <meta>

// X::~X is an ordinary destructor
struct X { ~X() { } };
static_assert(std::meta::is_destructor(^^X::~X));

// a deleted destructor is still a destructor
struct Y {  ~Y() = delete; };
static_assert(std::meta::is_destructor(^^Y::~Y));

// can't hide behind typedefs either
using XX = X;
static_assert(std::meta::is_destructor(^^X::~XX));
static_assert(std::meta::is_destructor(^^XX::~X));
static_assert(std::meta::is_destructor(^^XX::~XX));

int main() {}
static_assert(!std::meta::is_destructor(^^main));

See also