Namespaces
Variants

std::meta::is_user_declared

From cppreference.com
< cpp | meta
Defined in header <meta>
consteval bool is_user_declared( std::meta::info r );
(since C++26)

Returns true if r represents a function that is user-declared. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents a user-declared function; otherwise false.

Notes

If r does not represent a function, the result is false. In particular, the result is false if r represents a function template.

Example

#include <meta>

struct Base
{
    bool operator==(const Base&) const = default;
};

struct Derived : public Base
{
    std::strong_ordering operator<=>(const Derived&) const = default;

    // Derived::operator== is declared by the defaulted definition of operator<=>
};

static_assert(std::meta::is_user_declared(^^Base::operator==));
static_assert(!std::meta::is_user_declared(^^Derived::operator==));
static_assert(std::meta::is_user_declared(^^Derived::operator<=>));

int main() {}

See also

checks if reflection represents a function
(function) [edit]
checks if reflection represents a user-provided function
(function) [edit]