std::meta::is_override
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_override( std::meta::info r );
|
(since C++26) | |
Returns true if r represents a member function that overrides another member function (whether or not the override specifier is used). Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents a member function that overrides another member function; otherwise false.
Example
Run this code
#include <meta>
struct Base
{
virtual void f() = 0;
void g(); // non-virtual
};
struct Derived : public Base
{
void f() = 0; // overrides Base::f
virtual void g(); // does not override Base::g
};
static_assert(!std::meta::is_override(^^Base::f));
static_assert(std::meta::is_override(^^Derived::f));
static_assert(!std::meta::is_override(^^Derived::g));
int main() {}
