is_invocable#
Fully qualified name: carb::cpp::is_invocable
Defined in carb/cpp/TypeTraits.h
-
template<typename Func, typename ...TArgs>
struct is_invocable : public detail::is_invocable_impl<void, Func, TArgs...># Check if the
Funcis invocable with theTArgspack.If
Funcis callable with the givenTArgspack, then this structure will derive fromtrue_type; otherwise, it will befalse_type. Ifvalueistrue, theninvoke(func, args...)is a valid expression.static_assert(is_invocable<void(*)()>::value); static_assert(!is_invocable<void(*)(int)>::value); static_assert(is_invocable<void(*)(int), int>::value); static_assert(is_invocable<void(*)(long), int>::value);
This is equivalent to the C++20
std::is_invocablemeta query. The query was added in C++17, but this additionally supports invoking a pointer to aconst&member function on an rvalue reference.