加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 用提升精神分析一对ints

发布时间:2020-12-16 03:17:05 所属栏目:百科 来源:网络整理
导读:我有以下代码: std::string test("1.1");std::pairint,int d;bool r = qi::phrase_parse( test.begin(),test.end(),qi::int_ '.' qi::int_,space,d ); 所以我试图解析字符串测试,将结果放在std :: pair d中.但是这并不奏效,我怀疑它与Compound Attribute Ru
我有以下代码:
std::string test("1.1");
std::pair<int,int> d;

bool r = qi::phrase_parse(
        test.begin(),test.end(),qi::int_ >> '.' >> qi::int_,space,d
        );

所以我试图解析字符串测试,将结果放在std :: pair d中.但是这并不奏效,我怀疑它与Compound Attribute Rules有关.

任何暗示如何让这个工作?

编译器错误如下:

error: no matching function for call
to ‘std::pair::pair(const
int&)’

解决方法

应该工作人们经常忘记的是添加一个
#include <boost/fusion/include/std_pair.hpp>

到他们的列表.这是必要的,使std ::对一个完整的融合公民.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读