I am using Boost::Spirit to parse some text into structs. This requires using BOOST_FUSION_ADAPT_STRUCT for parsing text and directly storing into the structure. I know that the macro takes 2 arguments: the structure name as the 1st arg and all the structure members as the 2nd argument. And I am passing just those 2. But I get a compilation error saying,
error: macro "BOOST_FUSION_ADAPT_STRUCT_FILLER_0" passed 3 arguments, but takes just 2
Here is the code snippet. Let me know if you need the entire code.
Thanks.
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))
This is the rule I am trying to parse,
qi::rule<Iterator, Dir_Entry_Pair()> ppair = dir
>> '/'
>> entry
>> -(keyword >> entry);
Most likely the issue is std::pair<std::string,std::string>
.
The problem is that there is a comma in the type, which will play havoc with the macro expansion (when using the last element of your list).
You should try wrapping the type in its own set of parentheses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With