Spirit X3:复合组件的基本示例无法编译
Spirit X3: Basic example for compound components does not compile
此代码是从 x3 文档中逐字提取的,无法编译
#include <string>
#include <utility>
#include <boost/spirit/home/x3.hpp>
namespace x3 = boost::spirit::x3;
int main(int argc, char* argv[]) {
std::string input("(1.0, 2.0)");
std::string::iterator strbegin = input.begin();
std::pair<double, double> p;
x3::parse(strbegin, input.end(),
'(' >> x3::double_ >> ", " >> x3::double_ >> ')',
p);
return 0;
}
使用 Boost 1.63、1.61 和 Gcc 7、6.2 测试失败:
/home/dvd/Projects/personal/iforeader/main.cpp:27:4: required from here
/home/dvd/Projects/personal/iforeader/3rdparty/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);
我遗漏了一些明显的东西?
包括
#include <boost/fusion/adapted/std_pair.hpp>
缺失以允许该对属性兼容
此代码是从 x3 文档中逐字提取的,无法编译
#include <string>
#include <utility>
#include <boost/spirit/home/x3.hpp>
namespace x3 = boost::spirit::x3;
int main(int argc, char* argv[]) {
std::string input("(1.0, 2.0)");
std::string::iterator strbegin = input.begin();
std::pair<double, double> p;
x3::parse(strbegin, input.end(),
'(' >> x3::double_ >> ", " >> x3::double_ >> ')',
p);
return 0;
}
使用 Boost 1.63、1.61 和 Gcc 7、6.2 测试失败:
/home/dvd/Projects/personal/iforeader/main.cpp:27:4: required from here
/home/dvd/Projects/personal/iforeader/3rdparty/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);
我遗漏了一些明显的东西?
包括
#include <boost/fusion/adapted/std_pair.hpp>
缺失以允许该对属性兼容