
On 2/16/2011 7:04 AM, Hossein Haeri wrote:
Dear all,
In my namespace arity_caller, I have a struct CanBeCalled<> such that CanBeCalled
::type is an mpl::bool_<> representing whether T can be called with n doubles. I also have the following grammar (in a file called 'EmtnGram.hpp') in which I am trying to employ this CanBeCalled<>::type: struct EmtnShiftFObjGram: boost::proto::and_ < boost::proto::shift_right < EmtnTermOrGram, boost::proto::terminalboost::proto::_ >, boost::proto::if_ < arity_caller::CanBeCalled < boost::proto::_value(boost::proto::_right), EmtnTermOrGram(boost::proto::_left) >::type >
{};
When you access a member of a class template, it causes the template to be instantiated. CanBeCalled cannot legally be instantiated with two function types. Hence the error. Also, proto::if_ takes as it's template parameter a Transform. It should be a transform that evaluates to a compile-time Boolean. You can easily solve both problems by making the parameter to if_ an ObjectTransform, as follows: struct EmtnShiftFObjGram: boost::proto::and_ < boost::proto::shift_right < EmtnTermOrGram, boost::proto::terminalboost::proto::_ >, boost::proto::if_ < arity_caller::CanBeCalled < boost::proto::_value(boost::proto::_right), EmtnTermOrGram(boost::proto::_left) >() >
{}; Hope that helps, -- Eric Niebler BoostPro Computing http://www.boostpro.com