gpt4 book ai didi

c++ - Spirit X3 无匹配函数调用 'move_to'

转载 作者:太空狗 更新时间:2023-10-29 20:37:06 24 4
gpt4 key购买 nike

为什么这不能编译?(注释 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分支。之后代码无需任何更改即可运行。

关于c++ - Spirit X3 无匹配函数调用 'move_to',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36024848/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com