Question

I have an empty struct:

struct MyStruct {};

I want to adapt this to be used by Boost Fusion. Ordinarily I would use BOOST_FUSION_ADAPT_STRUCT, but this macro requires two parameters to name the struct and list its fields. Is there anyway to tell the macro that the fields are non-existent?

Motivation: I am using Boost Spirit to define a parser. The struct is for a boost::variant that is then passed to boost::apply_visitor(). Some of the other items in the variant given the boost::fusion::for_each() treatment.

Was it helpful?

Solution

I tried passing /**/ as the second parameter and it compiled for me (g++-4.6.2).

    BOOST_FUSION_ADAPT_STRUCT(MyStruct, /**/);

OTHER TIPS

Try passing BOOST_PP_EMPTY. No guarantees that it will work, but given the implementation it seems likely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top