c++ - Boost Spirit 自动解析器因 double 元组而失败

标签 c++ parsing auto boost-spirit-qi boost-tuples

在下面的代码中,我尝试使用 Boost Spirit Auto Parser对于一个序列或两个 double ,但它不编译。我在这里做错了什么?

// file main.cpp

#include <boost/tuple/tuple.hpp>
#include <boost/spirit/include/qi.hpp>

namespace qi = boost::spirit::qi;

int main()
{
    boost::tuple<double, double> p;
    char* i = 0;
    qi::phrase_parse( i, i, p, qi::space );
    // qi::phrase_parse( i, i, qi::double_ >> qi::double_, qi::space, qi::skip_flag::postskip, p );

    return 0;
}

注释掉的行编译,所以它接受 boost::tuple<double, double>作为 qi::double_ >> qi::double_ 的属性类型;但是它无法从属性类型中获取解析器。为什么?

最佳答案

这与您的 other question 中的答案相同- 使用 boost::fusion::vector 代替。

关于c++ - Boost Spirit 自动解析器因 double 元组而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9443131/

相关文章:

c++ - 验证 Win32 窗口句柄

c++ - Visual Studio 2010 C++ : malloc()/HeapAlloc always allocates new page for even smallest alloc size

html - 在专用服务器中解析网站的 HTML,而不是在手机中解析

ruby-on-rails - 在 Rails Controller 或普通 ruby​​ 中检查 CSS?

c++ - auto 作为函数参数

c++ - 为什么我不能在 linux 的代码块中使用 "auto"

c++ - string::substr 中无法解释的 out_of_range

Python 正则表达式,多行匹配模式.. 为什么这不起作用?

C++:在原型(prototype)中声明 `auto` 函数返回类型仍然导致在推导错误之前使用 `auto`

c++ - 在 Windows 上编译 NodeJS C++ 模块?