Nested Boost Fusion Structs

Is it possible to define (or adapt) a Boost Fusion structure that contains a Boost Fusion structs member in a single expression?

For example, how can I adapt or define something equivalent to this:

struct Outer
{
   int i;
   float j;
   struct Nested
   { 
      int a;
   } nested;
};

If both Outerand Outer::Nestedare reflective types.

Defining all inner types in order of least grace is very erratic and externally reflects inner types.

+4
source share
1 answer

You should be able to "define" the internal structure using its full name:

BOOST_FUSION_ADAPT_STRUCT(
  Outer::Nested,
  a
)

BOOST_FUSION_ADAPT_STRUCT(
  Outer,
  i,
  j,
  nested
)
+3
source

Source: https://habr.com/ru/post/1653139/


All Articles