From 534a15d05e0b6e1b44b6387003e1475150e848e8 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 29 Sep 2019 18:01:45 +0900 Subject: function_traits: drop unused pieces is_callable won't ever be needed because std::is_invokable is here; arg_number and returns() didn't find its users; and function_type has been just broken all along for member functions. --- lib/util.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'lib/util.h') diff --git a/lib/util.h b/lib/util.h index 788ce5bc..4631570f 100644 --- a/lib/util.h +++ b/lib/util.h @@ -154,23 +154,19 @@ struct function_traits : public _impl::fn_traits {}; // Specialisation for a function template struct function_traits { - static constexpr auto is_callable = true; using return_type = ReturnT; using arg_types = std::tuple; - using function_type = std::function; - static constexpr auto arg_number = std::tuple_size::value; }; namespace _impl { template - struct fn_traits { - static constexpr auto is_callable = false; - }; + struct fn_traits; + // Specialisation for function objects with (non-overloaded) operator() + // (this includes non-generic lambdas) template struct fn_traits - : public fn_traits { - }; // A generic function object that has (non-overloaded) operator() + : public fn_traits {}; // Specialisation for a member function template @@ -190,16 +186,6 @@ template using fn_arg_t = std::tuple_element_t::arg_types>; -template -constexpr bool returns() -{ - return std::is_same, R>::value; -} - -// Poor-man's is_invokable -template -constexpr auto is_callable_v = function_traits::is_callable; - inline auto operator"" _ls(const char* s, std::size_t size) { return QLatin1String(s, int(size)); -- cgit v1.2.3