veselink1/refl-cpp

Feature: Better base type support in type_descriptor

veselink1 opened this issue · 0 comments

Problem

The base types of a type can be specified with the base_types<Ts...> attribute (or via the bases<Ts...> template variable). To get a usable type_list one has to currently use a combination of get_attribute, decltype and the type_list member typedef of base_types. This is bad for usability.

Solution

Add better support for enumerating base types by exposing a typedef and a member type_list on type_descriptor, implemented on top of base_types. Expose these via type_descriptor and in the refl:: and refl::descriptor:: namespaces for similarity with member_list.

Possible interface

  1. Have base_types and indirect_base_types types, where the first variant is the directly declared bases, and the indirect variant is the full list of all direct and indirect bases.
  2. Have declared_base_types and base_types types, where the first variant is the directly declared bases, and the indirect variant is the full list of all direct and indirect bases. This matches better with the naming convention in #27 (Support inherited members) but might be less clear.