Synchronised etl::invoke_result with that in the etl::inplace_function branch

This commit is contained in:
John Wellbelove 2025-12-20 09:39:50 +00:00
parent c8dc46ec9b
commit 06057b59ae

View File

@ -183,19 +183,34 @@ namespace etl
//****************************************************************************
/// invoke_result<TFunction, TArgs...>
template <typename TFunction, typename ... TArgs>
struct invoke_result;
template <typename TFunction, typename, typename... TArgs>
struct invoke_result
{
using type = void;
};
//*******************************************
template <typename TFunction, typename... TArgs>
struct invoke_result<TFunction,
etl::void_t<decltype(etl::invoke(etl::declval<TFunction>(), etl::declval<TArgs>()...))>,
TArgs...>
TArgs...>
{
using type = decltype(etl::invoke(etl::declval<TFunction>(), etl::declval<TArgs>()...));
};
//*******************************************
// Specialization to allow `etl::type_list<...>` as the second template parameter.
template <typename TFunction, typename... TArgs>
using invoke_result_t = typename invoke_result<TFunction, TArgs...>::type;
struct invoke_result<TFunction,
etl::void_t<decltype(etl::invoke(etl::declval<TFunction>(), etl::declval<TArgs>()...))>,
etl::type_list<TArgs...>>
{
using type = decltype(etl::invoke(etl::declval<TFunction>(), etl::declval<TArgs>()...));
};
//*******************************************
template <typename TFunction, typename... TArgs>
using invoke_result_t = typename invoke_result<TFunction, void, TArgs...>::type;
//****************************************************************************
/// is_invocable<TFunction, TArgs...>