lundi 6 mars 2023

boost::describe: Can I add annotations to types and/or members?

Is it possible, using the boost::describe library, to add additional information about a given type or member?

For instance, if I have a class described like this:

BOOST_DESCRIBE_STRUCT(Foo, (), (bar, baz))

Is there any way to add some kind of additional info, like a tag or flag, to either the members or the type? There's a lot of information about members, such as name, type, visibility, etc. Is there a way to add some custom info to that?

To flag types, I've tried using type traits with std::true_type or std::false type.

However, these are cumbersome to use, because template specializations must be done in the namespace where the type traits were defined, not the namespace where the types being described are defined.





Aucun commentaire:

Enregistrer un commentaire