私はこの典型的なスピリットコードを持っています。
#include <boost/spirit/home/x3.hpp>
#include <boost/fusion/container/vector.hpp>
#include<iostream>
using std::cout;
int main(){
namespace x3 = boost::spirit::x3;
boost::fusion::vector<double, double> p;
x3::phrase_parse(
s.begin(), s.end(),
x3::double_ >> x3::double_, x3::space,
p
);
assert( boost::fusion::at_c<0>(p) == 1.2 );
assert( boost::fusion::at_c<1>(p) == 3.4 );
}
文法から期待される属性のタイプを推測することは可能ですか?
何かのようなもの
using att_type = decltype(x3::double_ >> x3::double_)::result_type;
を推測しboost::fusion::vector<double, double>
ます。
私はこれを見つけましたhttp://boost-spirit.com/home/2010/01/31/what-is-the-attribute-type-exposed-by-a-parser/しかし、それは動作しないx3
か、そうではありません正しいヘッダーを含みます。