Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d15508

Browse files
committed
Reduce class instantiations for invoke/invoke_r
1 parent a72c802 commit 2d15508

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

include/eggs/invoke.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,10 @@ namespace eggs
383383
//! - _Remarks_: This function shall not participate in overload resolution
384384
//! unless `eggs::is_invocable_v<F, Args...>` is `true`.
385385
template <typename Fn, typename... ArgTypes>
386-
constexpr invoke_result_t<Fn, ArgTypes...>
386+
constexpr auto
387387
invoke(Fn&& f, ArgTypes&&... args)
388-
noexcept(is_nothrow_invocable<Fn, ArgTypes...>::value)
388+
noexcept(noexcept(EGGS_INVOKE(EGGS_FWD(f), EGGS_FWD(args)...)))
389+
-> decltype(EGGS_INVOKE(EGGS_FWD(f), EGGS_FWD(args)...))
389390
{
390391
return EGGS_INVOKE(EGGS_FWD(f), EGGS_FWD(args)...);
391392
}
@@ -399,11 +400,11 @@ namespace eggs
399400
//!
400401
//! - _Remarks_: This function shall not participate in overload resolution
401402
//! unless `eggs::is_invocable_r_v<R, F, Args...>` is `true`.
402-
template <typename R, typename Fn, typename... ArgTypes, typename Enable =
403-
typename std::enable_if<is_invocable_r<R, Fn, ArgTypes...>::value>::type>
404-
constexpr R
403+
template <typename R, typename Fn, typename... ArgTypes>
404+
constexpr auto
405405
invoke_r(Fn&& f, ArgTypes&&... args)
406-
noexcept(is_nothrow_invocable_r<R, Fn, ArgTypes...>::value)
406+
noexcept(noexcept(EGGS_INVOKE_R(R, EGGS_FWD(f), EGGS_FWD(args)...)))
407+
-> decltype(EGGS_INVOKE_R(R, EGGS_FWD(f), EGGS_FWD(args)...))
407408
{
408409
return EGGS_INVOKE_R(R, EGGS_FWD(f), EGGS_FWD(args)...);
409410
}

0 commit comments

Comments
 (0)