From: Michael C. <bo...@ob...> - 2010-01-15 23:01:37
|
Michael Caisse wrote: > I have a class that can take qi "grammars". These can > be rules, grammars or I hope the results of an auto. > > I have this little test case that shows my problem: > > > -------- > > #include <boost/spirit/include/qi.hpp> > > > #define BOOST_SPIRIT_AUTO(domain_, name, expr) \ > typedef BOOST_TYPEOF(expr) name##_expr_type; \ > BOOST_SPIRIT_ASSERT_MATCH( \ > boost::spirit::domain_::domain, name##_expr_type); \ > BOOST_AUTO(name, boost::proto::deep_copy(expr)); \ > // > > namespace spirit = boost::spirit; > namespace qi = spirit::qi; > > int main(void) > { > BOOST_SPIRIT_AUTO( > qi, auto_rule, > *qi::int_ > ); > > // ok > auto_rule_expr_type foo = *qi::int_; > > // compiler error > auto_rule_expr_type bar = auto_rule; > > // compiler error > auto_rule_expr_type gorp( auto_rule ); > > return 0; > } > > -------- > Looks like the result of BOOST_TYPEOF and that of boost::proto::deep_copy are not the same. How 'bout this for a patch? #define BOOST_SPIRIT_AUTO(domain_, name, expr) \ typedef boost::proto::result_of::deep_copy<BOOST_TYPEOF(expr)>::type name##_expr_type; \ BOOST_SPIRIT_ASSERT_MATCH( \ boost::spirit::domain_::domain, name##_expr_type); \ BOOST_AUTO(name, boost::proto::deep_copy(expr)); \ // michael -- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com |