I would like to create a compile-type function that, given any callable object f (function, lambda expression, function object, ...) and a type T,
template
struct is_callable_with_impl : std::false_type {};
template
struct is_callable_with_impl() (std::declval()) ) >::type
> : std::true_type {};
template
constexpr bool is_callable_with(F &&)
{
return is_callable_with_impl< F, T >::value;
}
It is basically the same solution as the one posted by Paul, I just prefer to use conditional instead of an holder class to avoid namespace pollution.