小编use*_*328的帖子

暧昧变种和提升精神x3

试图调整boost spirit x3 calc示例来解析可以将函数作为参数的函数.但是它没有编译.

namespace client{ namespace ast{
    struct ts;
    struct fnc;
    typedef boost::variant<
    ts,
    boost::recursive_wrapper<fnc>
    > node;
    struct ts{
        unsigned int id;
    };
    struct fnc{
        std::vector<char> id;
        std::vector<node> args;
    };
}}
BOOST_FUSION_ADAPT_STRUCT(
    client::ast::ts,
    (unsigned int, id)
)
BOOST_FUSION_ADAPT_STRUCT(
    client::ast::fnc,
    (std::vector<char>, id)
    (std::vector<client::ast::node>, args)
)
namespace client{
    namespace x3 = boost::spirit::x3;
    namespace calc_grammar{
        using x3::uint_;
        using x3::alpha;
        using x3::alnum;
        using x3::lit;
        using x3::char_;
        x3::rule<class funct, ast::fnc> const funct("function");
        x3::rule<class ts, ast::ts> const ts("timeseries");
        x3::rule<class funct_name, std::vector<char>> const funct_name("function_name");
        auto const …
Run Code Online (Sandbox Code Playgroud)

c++ boost-spirit visual-c++ boost-spirit-x3

10
推荐指数
1
解决办法
1519
查看次数

标签 统计

boost-spirit ×1

boost-spirit-x3 ×1

c++ ×1

visual-c++ ×1