
I have a second example here , this uses BOOST_FUSION_ADAPT_STRUCT: http://www.softobjects.co.uk/mediawiki-1.16.0/index.php/Boost::Spirit_JSON_F... The key bit of interest to you is: struct JsonMember; ///< Forward declaration of JsonObject /** * Declare JsonValue as a bopost variant. * * Note: boost::recursive_wrapper is used to allow the JsonValue to * include a vector of JsonMember which has been forward * declared. * * Note: boost::make_recursive_variant is used to allow the JsonValue to * include a vector of JsonValue. * */ typedef boost::make_recursive_variant< bool , double , std::string , boost::recursive_wrapper< std::vector< JsonMember >
, std::vector< boost::recursive_variant_ > >::type JsonValue; /** * Structure for parse Json members. */ struct JsonMember { std::string name; ///< the name of the member JsonValue value; ///< the value of the member /** constructor */ JsonMember() : name() , value() {} /** * Convenience constructor. * * \param nm the name of the member. * \param val the value for the member. */ JsonMember( const std::string& nm, const JsonValue& val ) : name(nm) , value(val) {} }; /** * Adapt the JsonMember structure using boost::fusion so that it can * be used with boost::spirit::qi. */ BOOST_FUSION_ADAPT_STRUCT( JsonMember, ( std::string, name ) ( JsonValue, value ) ) in this case there is no inheritance hierarchy, but I believe you should be able to simply us BOOST_FUSION_ADAPT_STRUCT in the following way: BOOST_FUSION_ADAPT_STRUCT( DerivedStatement0, ( Type_of_member1, name_of_member1 ) // .... ( Type_of_memberN, name_of_memberN ) ) -- View this message in context: http://boost.2283326.n4.nabble.com/Parsing-statements-from-ascii-files-in-ar... Sent from the Boost - Users mailing list archive at Nabble.com.