describe icon indicating copy to clipboard operation
describe copied to clipboard

Add member type to `member_descriptor`

Open Lastique opened this issue 10 months ago • 1 comments

I have a use case where I would like to process types of members of a described struct. While it is possible to deduce the member type from member_descriptor::pointer, I think it would be helpful if the type was readily available as a member_descriptor::type typedef. This would save the user from having to define helper traits such as this:

template< typename T >
struct member_type;

template< typename T, typename U >
struct member_type< T (U::*) >
{
    using type = T;
};

template< typename Descr >
struct deduce_member_type :
    member_type< std::remove_cv_t< decltype(Descr::pointer) > >
{
};

Lastique avatar Feb 17 '25 19:02 Lastique

Also, if you'd like to indicate the class which the member belongs to (in case of inherited members), you could add a typedef for it as well. But this is not needed for my use case.

Lastique avatar Feb 18 '25 13:02 Lastique