
Am 14.03.21 um 18:33 schrieb Peter Dimov via Boost:
mod_virtual is necessary for the implementation of mod_inherited for base classes (virtual bases of the same type must only be returned once.)
Since the library has to compute it anyway, I might as well return it to the user.
My original design (which was about a compiler implementation of these reflection facilities) had more such output-only "modifiers", such as mod_final and mod_overridden. These, along with mod_virtual, were supposed to be returned in member function descriptors - the compiler knows all this and we can't get it in any other way, so why not return it. In the library implementation, only mod_virtual for bases remained. :-)
This reminds me of a question I had earlier but forgot: Given C++17 constexpr if I think it would be useful to return ALL members and then constexpr if on the type. E.g. currently it is not possible to do: boost::mp11::mp_for_each<describe_members<T, mod_any_access>>([&](auto D){ if constexpr(is_function(D)) handle_function if constexpr(is_variable(D)) handle_variable } I think the situation where this would be most useful is: boost::mp11::mp_for_each<describe_members<T, mod_any_access | mod_function>>([&](auto D){ some_computation // use the result of the computation to call functions which may be static if constexpr(is_static(D)) handle_static_function else handle_member_function } I.e. the problem with the toggles is, that they are toggles only. It is impossible to return both static and not-static members, which especially for functions is useful In general it is impossible to return ALL members, e.g. `boost::mp11::mp_for_each<describe_members<T>>` could be useful, especially for a compiler implementation Also a reminder that those toggles should stand out. E.g. I was wondering whether mod_hidden meant, that only hidden members are returned or in addition. :) Just thinking out loud: `describe_members<T, mod_any_access, mod_function, mod_static>` and `describe_members<T, mod_any_access, mod_data, mod_nonstatic>` could work too and make that clear if those are kept as toggles.