aboutsummaryrefslogtreecommitdiff
path: root/lib/util.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-02 15:24:44 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-02 15:24:44 +0100
commitdc08fb9dfd474023084de9ce86f29f177ca52fdc (patch)
tree29cb5ab8a133bc46c4ccbee1cd369cd665525949 /lib/util.cpp
parentae0ad49f36e8ba5983839581302ed16ddbd75d5f (diff)
downloadlibquotient-dc08fb9dfd474023084de9ce86f29f177ca52fdc.tar.gz
libquotient-dc08fb9dfd474023084de9ce86f29f177ca52fdc.zip
Improve function_traits<>; split out from util.*
Quotient::function_traits<> did not support member functions in a proper way (i.e. the way std::invoke_result<> treats them, with the function's owning class represented as the first parameter). Now that I gained the skill and understanding in function_traits<> somewhat wicked machinery, I could properly support member functions. Overloads and generic lambdas are not supported but maybe we'll get to those one day.
Diffstat (limited to 'lib/util.cpp')
-rw-r--r--lib/util.cpp32
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/util.cpp b/lib/util.cpp
index 2dfb09a6..03ebf325 100644
--- a/lib/util.cpp
+++ b/lib/util.cpp
@@ -135,35 +135,3 @@ int Quotient::patchVersion()
{
return Quotient_VERSION_PATCH;
}
-
-// Tests for function_traits<>
-
-using namespace Quotient;
-
-int f_();
-static_assert(std::is_same<fn_return_t<decltype(f_)>, int>::value,
- "Test fn_return_t<>");
-
-void f1_(int, QString);
-static_assert(std::is_same<fn_arg_t<decltype(f1_), 1>, QString>::value,
- "Test fn_arg_t<>");
-
-struct Fo {
- int operator()();
- static constexpr auto l = [] { return 0.0f; };
-};
-static_assert(std::is_same<fn_return_t<Fo>, int>::value,
- "Test return type of function object");
-static_assert(std::is_same<fn_return_t<decltype(Fo::l)>, float>::value,
- "Test return type of lambda");
-
-struct Fo1 {
- void operator()(int);
-};
-static_assert(std::is_same<fn_arg_t<Fo1>, int>(),
- "Test fn_arg_t defaulting to first argument");
-
-template <typename T>
-static QString ft(T&&);
-static_assert(std::is_same<fn_arg_t<decltype(ft<QString>)>, QString&&>(),
- "Test function templates");