【发布时间】:2013-12-31 18:28:10
【问题描述】:
我有一部分语法如下:
typedef SemanticActions< IterType > SemanticActionsType;
string_ %= lexeme[ +( spirit::qi::alnum | punct )];
component_ = lit( '-' ) >> string_[boost::bind( &SemanticActionsType::new_component_name, &actions_, _1, _2 )]
以及对应的语义动作类:
template< typename IterType >
class SemanticActions
{
public:
SemanticActions( Design_p d ) : design_( d )
{
}
void print(int const& i) const
{
std::cout << i << std::endl;
}
void new_component_name ( std::string::iterator const b, std::string::iterator const e) const
{
cout << "new component name" << endl;
}
我可以从 int_ 令牌调用“打印”函数,但无法从 string_ 令牌调用 new_component_name。
我收到以下错误: boost/include/boost/bind/bind.hpp:397:9: No matching function for call to object of type 'const boost::_mfi::cmf2 >, std:: __1::__wrap_iter, std::__1::__wrap_iter >'
我已经尝试过迭代器对参数以及“std::string & s const”参数。
【问题讨论】:
标签: c++ boost boost-spirit boost-spirit-qi