, Bar std::is_function, . - . ( fooobar.com/questions/396964/...):
template<class F, class... T, typename = decltype(std::declval<F>()(std::declval<T>()...))>
std::true_type supports_test(const F&, const T&...);
std::false_type supports_test(...);
template<class> struct supports;
template<class F, class... T> struct supports<F(T...)>
: decltype(supports_test(std::declval<F>(), std::declval<T>()...)){};
struct Bar {
void operator()() {}
void operator()(double) {}
};
int main(){
static_assert( supports<Bar()>::value == true , "");
static_assert( supports<Bar(double)>::value == true , "");
static_assert( supports<Bar(int)>::value == true , "");
static_assert( supports<Bar(std::string)>::value == false , "");
}