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

std::meta::is_user_provided

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_user_provided( std::meta::info r );
(since C++26)

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

Parameters

r - a reflection value

Return value

true if r represents a user-provided 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 <compare>
#include <meta>

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

    std::strong_ordering operator<=>(const Base&) const = delete;
};

bool Base::operator==(const Base&) const = default;

struct Derived : public Base
{
    bool operator==(const Derived&) const { return true; }

    std::strong_ordering operator<=>(const Derived&) const = default;
};

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

int main() {}

See also