
On 29 January 2014 17:28, John Maddock wrote:
A better C++11 style interface *if* it can be implemented would be something like:
template <class F, class Args...> struct is_callable;
Which inherits from true_type only if F is callable with arguments Args...
The tricky part is creating a decent interface that can deal with both lvalue and rvalue refs as arguments correctly.
Actually I was sure there was something similar in the C++11 std, but I couldn't find anything.
It doesn't exist, but all std::lib implementations need something like it, so it would be a good candidate for standardisation. The traits in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3866.html provide even more functionality. is_callable<F(Args...)>::value would be true iff raw_invocation_type<F(Args...)::type exists.