【发布时间】:2011-10-21 02:55:48
【问题描述】:
我正在使用 Boost::Spirit 将一些文本解析为结构。这需要使用 BOOST_FUSION_ADAPT_STRUCT 来解析文本并直接存储到结构中。我知道宏需要 2 个参数:结构名称作为第一个参数,所有结构成员作为第二个参数。我只通过了这 2 个。但是我收到一个编译错误,说,
error: macro "BOOST_FUSION_ADAPT_STRUCT_FILLER_0" passed 3 arguments, but takes just 2
这里是代码 sn-p。如果您需要完整的代码,请告诉我。
谢谢。
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);
【问题讨论】:
标签: c++ boost boost-spirit-qi boost-fusion