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
Func
is invocable with theTArgs
pack.If
Func
is callable with the givenTArgs
pack, then this structure will derive fromtrue_type
; otherwise, it will befalse_type
. Ifvalue
istrue
, 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_invocable
meta query. The query was added in C++17, but this additionally supports invoking a pointer to aconst&
member function on an rvalue reference.