解析一对ints与精神 [英] Parsing a pair of ints with boost spirit
本文介绍了解析一对ints与精神的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码:
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 。但是它不工作,我怀疑它与复合属性规则。
So I'm trying to parse the string test and place the result in the std::pair d. However it is not working, I suspect it has to do with the Compound Attribute Rules.
任何提示如何使此工作正常?
Any hints to how to get this working?
编译错误如下:
错误:没有匹配的函数调用
到'std :: pair :: pair (const
int&)'
error: no matching function for call to 'std::pair::pair(const int&)'
推荐答案
人们经常忘记的是添加
#include <boost/fusion/include/std_pair.hpp>
这是必要的使 std :: pair
一个全面的融合公民。
to their list of includes. This is necessary to make std::pair
a full blown Fusion citizen.
这篇关于解析一对ints与精神的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文