我尝试了精神 x3 文档中的以下示例
#include <string>
#include <iostream>
#include "boost/spirit/home/x3.hpp"
namespace x3 = boost::spirit::x3;
int main()
{
std::pair<double, double> p;
std::string input("1.0 2.0");
std::string::iterator input_pos = input.begin();
x3::phrase_parse(input_pos, input.end(),
x3::double_ >> x3::double_,
x3::space, p);
}
我得到的错误是
[...]/boost/boost-1.61.0/include/boost/spirit/home/x3/support/traits/move_to.hpp:62:18: error: no match for ‘operator=’ (operand types are ‘std::pair<double, double>’ and ‘std::remove_reference<double&>::type {aka double}’)
dest = std::move(src);
如果我更改p
为 typedouble
它会编译并匹配2.0
。这显然不是我的本意。我尝试使用多个版本的 gcc(4.9、6.2、trunk)和 boost 版本 1.61.0。我觉得这应该是配置问题,除非有人在代码中发现错误。
是否有人经历过类似的事情并知道问题出在哪里?