[spirit] How to detect Spirit.Qi expressions?
Hi, Is there a way to detect at compile time that a certain type is a Boost.Spirit.Qi parser? That includes template expressions and grammars. Basically, I want to detect if qi::parse(b, e, expr) would be a sensible thing to do. I tried this: boost::is_same< typename proto::domain_of< ExpressionT >::type, spirit::qi::domain
But domain_of returns default_domain for Boost.Spirit.Qi template expressions.
2014-03-30 20:52 GMT+08:00 Andrey Semashev
Hi,
Is there a way to detect at compile time that a certain type is a Boost.Spirit.Qi parser? That includes template expressions and grammars. Basically, I want to detect if qi::parse(b, e, expr) would be a sensible thing to do.
I tried this:
boost::is_same< typename proto::domain_of< ExpressionT >::type, spirit::qi::domain
But domain_of returns default_domain for Boost.Spirit.Qi template expressions.
Try this: boost::spirit::traits::matches< Domain, Expr >
On Sunday 30 March 2014 21:15:29 TONGARI J wrote:
2014-03-30 20:52 GMT+08:00 Andrey Semashev
: Hi,
Is there a way to detect at compile time that a certain type is a Boost.Spirit.Qi parser? That includes template expressions and grammars. Basically, I want to detect if qi::parse(b, e, expr) would be a sensible thing to do.
I tried this: boost::is_same<
typename proto::domain_of< ExpressionT >::type, spirit::qi::domain
But domain_of returns default_domain for Boost.Spirit.Qi template expressions.
Try this: boost::spirit::traits::matches< Domain, Expr >
Thanks, this seems to work. Is it documented anywhere? Can I use it without safely?
participants (2)
-
Andrey Semashev
-
TONGARI J