Skip to content

Commit

Permalink
Merge pull request #235 from AntelopeIO/remove_callable_v_workaround
Browse files Browse the repository at this point in the history
[4.0 -> main] merge up #233: remove `is_callable_v<>` workaround
  • Loading branch information
spoonincode authored Sep 26, 2023
2 parents 46b336c + 89bb917 commit dae43fd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ namespace bluegrass { namespace meta {
inline constexpr U&& make_dependent(U&& u) { return static_cast<U&&>(u); }
}

template <typename F>
constexpr bool is_callable(F&& fn) { return BLUEGRASS_HAS_MEMBER(fn, operator()); }

namespace detail {
template <bool Decay, typename R, typename... Args>
constexpr auto get_types(R(Args...)) -> std::tuple<R, freestanding,
Expand All @@ -100,7 +103,7 @@ namespace bluegrass { namespace meta {
std::tuple<std::conditional_t<Decay, std::decay_t<Args>, Args>...>>;
template <bool Decay, typename F>
constexpr auto get_types(F&& fn) {
if constexpr (std::is_invocable<F>::value)
if constexpr (is_callable(fn))
return get_types<Decay>(&F::operator());
else
return get_types<Decay>(fn);
Expand Down Expand Up @@ -142,7 +145,7 @@ namespace bluegrass { namespace meta {
constexpr auto parameters_from_impl(R(Cls::*)(Args...)const &&) -> pack_from_t<N, Args...>;
template <std::size_t N, typename F>
constexpr auto parameters_from_impl(F&& fn) {
if constexpr (std::is_invocable<F>::value)
if constexpr (is_callable(fn))
return parameters_from_impl<N>(&F::operator());
else
return parameters_from_impl<N>(fn);
Expand Down

0 comments on commit dae43fd

Please sign in to comment.