Spec-Zone.ru › C++

std::meta::is_destructor

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

is_constructoris_default_constructoris_copy_constructoris_move_constructor
(C++26)(C++26)(C++26)(C++26)
checks if the reflected entity is a constructor of this kind
(function)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/is_destructor

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API