我正在使用Boost::Spirit将一些文本解析为结构体。这需要使用BOOST_FUSION_ADAPT_STRUCT来解析文本并直接存储到结构中。我知道这个宏需要2个参数:第一个参数是结构体名称,第二个参数是所有结构体成员。我已经传递了这两个参数,但是编译时出现了错误:
error: macro "BOOST_FUSION_ADAPT_STRUCT_FILLER_0" passed 3 arguments, but takes just 2
这是代码片段。如果需要完整的代码,请告诉我。
谢谢。
namespace client
{
namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
namespace phoenix = boost::phoenix;
struct Dir_Entry_Pair
{
std::string dir;
std::string value1;
std::pair<std::string, std::string> keyw_value2;
};
}
BOOST_FUSION_ADAPT_STRUCT(
client::Dir_Entry_Pair,
(std::string, dir)
(std::string, value1)
(std::pair< std::string, std::string >, keyw_value2))
这是我正在尝试解析的规则,
qi::rule<Iterator, Dir_Entry_Pair()> ppair = dir
>> '/'
>> entry
>> -(keyword >> entry);