
On 2/24/2010 10:36 PM, Jesse Perla wrote:
So there any ways to implement a metafunction can_be_called on a phoenix functor s.t.: auto f = _1 + _2; static_assert(is_callable
::value, ""); static_assert(!is_callable ::value, ""); static_assert(!is_callable ::value, ""); //Needs 2 args A while back, I was pointed towards the following from proto to determine if a functor was callable: http://www.boost.org/doc/libs/1_42_0/doc/html/proto/appendices.html#boost_pr... pendices.implementation.function_arity
This seemed to work well for most of my custom built functors, but as far as I can tell, the trick doesn't work for either boost::lambda or boost::phoenix functors (or std::tr1::bind for that matter). I can post a test case for phoenix if people think that it should work.
All phoenix callables are 'actors': template <typename Eval> struct actor; should be easy enough to detect. There is in fact something that you can use: template <typename T> struct is_actor; Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon