Spirit X3 没有匹配函数调用 'move_to'
Spirit X3 no matching function for call to 'move_to'
为什么编译不通过?
(注释 r3
会编译,但我想要规则中的分号)
#include <boost/spirit/home/x3.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <string>
#include <vector>
struct v
{
std::string value;
};
BOOST_FUSION_ADAPT_STRUCT
(
v,
(std::string, value)
)
using namespace boost::spirit::x3;
auto r1 = rule<struct s1, std::string>{} = lexeme[+alpha];
auto r2 = rule<struct s2, v>{} = r1;
using ast = std::vector<v>;
auto r3 = rule<struct s3, ast>{} = *(r2 >> ';');
//auto r3 = rule<struct s3, ast>{} = *r2;
int main()
{
std::string script("a;");
auto begin = script.begin();
auto end = script.end();
ast a;
phrase_parse(begin, end, r3, space, a);
return a.size();
}
正如@jv_ 所建议的,我已经下载了 develop 分支。之后代码无需任何更改即可运行。
为什么编译不通过?
(注释 r3
会编译,但我想要规则中的分号)
#include <boost/spirit/home/x3.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <string>
#include <vector>
struct v
{
std::string value;
};
BOOST_FUSION_ADAPT_STRUCT
(
v,
(std::string, value)
)
using namespace boost::spirit::x3;
auto r1 = rule<struct s1, std::string>{} = lexeme[+alpha];
auto r2 = rule<struct s2, v>{} = r1;
using ast = std::vector<v>;
auto r3 = rule<struct s3, ast>{} = *(r2 >> ';');
//auto r3 = rule<struct s3, ast>{} = *r2;
int main()
{
std::string script("a;");
auto begin = script.begin();
auto end = script.end();
ast a;
phrase_parse(begin, end, r3, space, a);
return a.size();
}
正如@jv_ 所建议的,我已经下载了 develop 分支。之后代码无需任何更改即可运行。