diff --git a/src/base/func_util.hh b/src/base/func_util.hh index 6c461c32..760deb4d 100644 --- a/src/base/func_util.hh +++ b/src/base/func_util.hh @@ -90,13 +90,19 @@ invoke(Fn&& f, Args&&... args) noexcept( template struct is_invocable { - template - static auto test(U* p) - -> decltype((*p)(std::declval()...), void(), std::true_type()); - template + template + static auto test(U&& p) + -> decltype((std::declval().*p)(std::declval()...), + void(), + std::true_type()); + template + static auto test(U* p) -> decltype((*p)(std::declval()...), + void(), + std::true_type()); + template static auto test(...) -> decltype(std::false_type()); - static constexpr bool value = decltype(test(0))::value; + static constexpr bool value = decltype(test(0))::value; }; } // namespace func diff --git a/src/base/itertools.hh b/src/base/itertools.hh index e11c2309..d0e5b5fc 100644 --- a/src/base/itertools.hh +++ b/src/base/itertools.hh @@ -533,10 +533,11 @@ operator|(nonstd::optional in, template auto operator|(const T& in, const lnav::itertools::details::mapper& mapper) - -> std::vector + -> std::vector< + decltype(mapper.m_func(std::declval()))> { - using return_type - = std::vector; + using return_type = std::vector()))>; return_type retval; retval.reserve(in.size()); @@ -605,7 +606,9 @@ operator|(const std::vector>& in, return retval; } -template +template::value, int> = 0> auto operator|(const std::vector& in, const lnav::itertools::details::mapper& mapper)