Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0 -> main] merge up #233: remove is_callable_v<> workaround #235

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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