在尝试从我的代码库中创建一个较小的可重现的案例时,我会到达下面的代码。
对我来说,它无法用g ++ 6.1编译并提升1.60并提升开发效果。
语法和规则使用队列的默认类型和另一位,并且仅指定迭代器和签名。 这是问题吗?
#include <iostream>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_istream_iterator.hpp>
#include <boost/phoenix.hpp>
namespace qis = boost::spirit::qi;
namespace pnx = boost::phoenix;
using qis::_r1; using qis::_r2;
using qis::_val;
template <typename Iterator>
struct G2 : public qis::grammar<Iterator, int(int)>
{
G2()
: G2::base_type(start_)
{
start_ %= qis::int_
[
pnx::if_( _r1 == 5 )
[
_val = 6
]
.else_
[
_val = 7
]
];
}
qis::rule<Iterator, int(int)> start_;
};
template <typename Iterator>
struct G1 : public qis::grammar<Iterator, int(int)>
{
G1()
: G1::base_type(start_)
{
start_ %= g2_(_r1);
}
G2<Iterator> g2_;
qis::rule<Iterator, int(int)> start_;
};
template <typename Iterator>
struct G : public qis::grammar<Iterator, int()>
{
G()
: G::base_type(start_)
{
int i;
start_ %= g1_(i);
}
G1<Iterator> g1_;
qis::rule<Iterator, int()> start_;
};
int main()
{
G<boost::spirit::istream_iterator> g;
return 0;
}