Using boost::fusion is possible to iterate an adapted structure and get the name of each member of that structure.
Is there a way to retrieve also the name of the structure some way?
What I woulld like to do is the following: given the current scenario
namespace inner {
struct test_struct {
int a;
int b;
} }
BOOST_FUSION_ADAPT_STRUCT( inner::test_struct, a, b );
I'd like to have a function that will return "test_struct" (or "inner::test_struct" )
I did check the header file[*] containing struct_size and other extension classes but I haven't found any with that purpose.
Do you know if there is anything out there to do that?
[*] boost/fusion/adapted/struct/detail/extension.hpp
That's not a feature. You can see it by inspecting the output of the preprocessor.
You can see the
struct_member_nameextension, but no such literals for the struct name:As always, it may not be too hard to add your own macro to get the extra information. See e.g. Parsing Selector struct with alternating tokens using Boost Spirit X3 or Boost fusion sequence type and name identification for structs and class