2014-07-24 57 views
1

此代碼是從提振精神庫的例子,它的確定:升壓靈鳳凰功能錯誤

on_error<fail>(expr,error_handler_function(eh)("expecting ", _4, _3)); 

但是,此代碼未能在Xcode編譯:

on_error<fail>(expr,error_handler_function(eh)("expecting ", _4, _3, _1)); 

的錯誤信息:

/usr/local/include/boost/spirit/home/phoenix/core/detail/function_eval.hpp:115:30: 
    error: too many template arguments for class template 'result' 

    fn::template result<BOOST_PP_ENUM_PARAMS(N, a)> 
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

eh(error_handle)是正確的,我將添加的參數爲_1

+0

不要只_claim_「的'哎(error_handle)'是正確的」,顯示除去一些限制它!對錯誤至關重要(也許有人會說,它顯然不對:)) – sehe

回答

2

您添加了參數,但未能添加模板參數。

它需要是一個模板參數,因爲Phoenix期望完全多態的函子。


潛在的(取決於編譯器和庫版本),您可以通過使用

#define BOOST_SPIRIT_USE_PHOENIX_V3 
// and/or 
#define BOOST_RESULT_OF_USE_DECLTYPE