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.cpp | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) (limited to 'lib/util.cpp') diff --git a/lib/util.cpp b/lib/util.cpp index cc18d9ab..041a8aba 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -141,62 +141,28 @@ int f(); static_assert(std::is_same, int>::value, "Test fn_return_t<>"); -void f1(int); -static_assert(function_traits::arg_number == 1, - "Test fn_arg_number"); - -void f2(int, QString); -static_assert(std::is_same, QString>::value, +void f1(int, QString); +static_assert(std::is_same, QString>::value, "Test fn_arg_t<>"); -struct S { - int mf(); -}; -static_assert(is_callable_v, "Test member function"); -static_assert(returns(), - "Test returns<> with member function"); - struct Fo { int operator()(); }; -static_assert(is_callable_v, "Test is_callable<> with function object"); -static_assert(function_traits::arg_number == 0, "Test function object"); static_assert(std::is_same, int>::value, "Test return type of function object"); struct Fo1 { void operator()(int); }; -static_assert(function_traits::arg_number == 1, "Test function object 1"); -static_assert(is_callable_v, "Test is_callable<> with function object 1"); static_assert(std::is_same, int>(), "Test fn_arg_t defaulting to first argument"); #if (!defined(_MSC_VER) || _MSC_VER >= 1910) static auto l = [] { return 1; }; -static_assert(is_callable_v, "Test is_callable_v<> with lambda"); static_assert(std::is_same, int>::value, "Test fn_return_t<> with lambda"); #endif -template -struct fn_object { - static int smf(double) { return 0; } -}; -template <> -struct fn_object { - void operator()(QString); -}; -static_assert(is_callable_v>, "Test function object"); -static_assert(returns>(), - "Test returns<> with function object"); -static_assert(!is_callable_v>, "Test non-function object"); -// FIXME: These two don't work -// static_assert(is_callable_v::smf)>, -// "Test static member function"); -// static_assert(returns::smf)>(), -// "Test returns<> with static member function"); - template QString ft(T&&) { -- cgit v1.2.3