简体   繁体   中英

Nested Boost Fusion Structs

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

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

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

Where both Outer and Outer::Nested are reflectable types.

Defining all the internal types in inside-out order is very messy and exposes internal types externally.

You should be able to 'define' the inner struct using its fully qualified name:

BOOST_FUSION_ADAPT_STRUCT(
  Outer::Nested,
  a
)

BOOST_FUSION_ADAPT_STRUCT(
  Outer,
  i,
  j,
  nested
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM