Class member_class

Synopsis

#include <src/entt/core/type_traits.hpp>

template<typename Member>
class member_class

Description

Extracts the class of a non-static member object or function.

Template Parameters

Member - A pointer to a non-static member object or function.

Source

Lines 358-374 in src/entt/core/type_traits.hpp.

template<typename Member>
class member_class {
    static_assert(std::is_member_pointer_v<Member>, "Invalid pointer type to non-static member object or function");

    template<typename Class, typename Ret, typename... Args>
    static Class * clazz(Ret(Class:: *)(Args...));

    template<typename Class, typename Ret, typename... Args>
    static Class * clazz(Ret(Class:: *)(Args...) const);

    template<typename Class, typename Type>
    static Class * clazz(Type Class:: *);

public:
    /*! @brief The class of the given non-static member object or function. */
    using type = std::remove_pointer_t<decltype(clazz(std::declval<Member>()))>;
};





Add Discussion

Log in to comment