代替演算子 ('|') を含むルールの区切りをオフにしようとしていますが、互換性のない区切り文字に関するコンパイル エラーが発生します。例として、boost の calc2_ast_dump.cpp の例を取り上げ、構造体 dump_ast の ast_node ルールを次のように変更しました。
ast_node %= no_delimit[int_ | binary_node | unary_node];
しかし、これはコンパイルエラーになります:
/usr/include/boost/function/function_template.hpp:754:17: note: candidate function not viable: no known conversion
from 'const
boost::spirit::karma::detail::unused_delimiter<boost::spirit::karma::any_space<boost::spirit::char_encoding::ascii>
>' to 'const boost::spirit::karma::any_space<boost::spirit::char_encoding::ascii>' for 3rd argument
result_type operator()(BOOST_FUNCTION_PARMS) const
また、boost/spirit/home/karma/nonterminal/rule.hpp の関連コメント:
// If you are seeing a compilation error here stating that the
// third parameter can't be converted to a karma::reference
// then you are probably trying to use a rule or a grammar with
// an incompatible delimiter type.
私自身のプロジェクトでは、問題なく "no_delimit[a << b]" を実行できます (karma::space 区切り記号を使用)。
代替案について私が見逃しているものはありますか?no_delimit が「<<」では機能するのに、「|」では機能しないのはなぜですか?
ブースト 1.48 を使用していますが、バグ修正が必要でしたか?