
On 7/5/2010 11:33 AM, Edd Dawson wrote:
On 7/5/2010 6:59 PM, Jeffrey Lee Hellrung, Jr. wrote:
On 7/5/2010 10:46 AM, Edd Dawson wrote:
Hi all,
I'm looking for code that does what boost::function_types::parameter_types does but for functors. Support for things such as boost::bind/lambda/function/signals(1&2)/etc and the standard binders and adaptors would be nice.
If you want restrict yourself to monomorphic function objects, then it might be possible, but I don't know of a generic way to obtain the information you're seeking.
Ah yes, I didn't mean to imply that I was seeking a truly generic solution. A "sanctioned" collection of template specializations for common functor types would be fine.
You can create a trait which exposes the parameter and return types and specialize it for the function objects you'd be interested in using. E.g., template< class T > struct fn_traits; template< ... > struct fn_traits< boost::detail::binder< ... > > { ... }; Not the most robust solution (in that you may be relying on implementation details), but it might get you far enough... [...]
Without having a database of types upfront and employing an exponential algorithm, can_be_called is probably not going to get me what I want, right?
I agree, I don't think it helps in this case. - Jeff