aboutsummaryrefslogtreecommitdiff
path: root/lib/util.cpp
diff options
context:
space:
mode:
authorBlack Hat <bhat@encom.eu.org>2019-09-30 21:38:00 -0700
committerBlack Hat <bhat@encom.eu.org>2019-09-30 21:38:00 -0700
commit3e694fc4c85920d897979f955901cfd93dfba562 (patch)
treed9b2a84259ec6a41b6ecdc4d02d2c87a52794c1a /lib/util.cpp
parent6870ee0d7a0df3427845de07ddae1e2fd5768bbb (diff)
parentf71d16b56ab90e494d6a41c276210a4ce593987e (diff)
downloadlibquotient-3e694fc4c85920d897979f955901cfd93dfba562.tar.gz
libquotient-3e694fc4c85920d897979f955901cfd93dfba562.zip
Merge branch 'master' of https://github.com/quotient-im/libQuotient into bhat-libqtolm-update
Diffstat (limited to 'lib/util.cpp')
-rw-r--r--lib/util.cpp38
1 files changed, 2 insertions, 36 deletions
diff --git a/lib/util.cpp b/lib/util.cpp
index cc18d9ab..041a8aba 100644
--- a/lib/util.cpp
+++ b/lib/util.cpp
@@ -141,63 +141,29 @@ int f();
static_assert(std::is_same<fn_return_t<decltype(f)>, int>::value,
"Test fn_return_t<>");
-void f1(int);
-static_assert(function_traits<decltype(f1)>::arg_number == 1,
- "Test fn_arg_number");
-
-void f2(int, QString);
-static_assert(std::is_same<fn_arg_t<decltype(f2), 1>, QString>::value,
+void f1(int, QString);
+static_assert(std::is_same<fn_arg_t<decltype(f1), 1>, QString>::value,
"Test fn_arg_t<>");
-struct S {
- int mf();
-};
-static_assert(is_callable_v<decltype(&S::mf)>, "Test member function");
-static_assert(returns<int, decltype(&S::mf)>(),
- "Test returns<> with member function");
-
struct Fo {
int operator()();
};
-static_assert(is_callable_v<Fo>, "Test is_callable<> with function object");
-static_assert(function_traits<Fo>::arg_number == 0, "Test function object");
static_assert(std::is_same<fn_return_t<Fo>, int>::value,
"Test return type of function object");
struct Fo1 {
void operator()(int);
};
-static_assert(function_traits<Fo1>::arg_number == 1, "Test function object 1");
-static_assert(is_callable_v<Fo1>, "Test is_callable<> with function object 1");
static_assert(std::is_same<fn_arg_t<Fo1>, 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<decltype(l)>, "Test is_callable_v<> with lambda");
static_assert(std::is_same<fn_return_t<decltype(l)>, int>::value,
"Test fn_return_t<> with lambda");
#endif
template <typename T>
-struct fn_object {
- static int smf(double) { return 0; }
-};
-template <>
-struct fn_object<QString> {
- void operator()(QString);
-};
-static_assert(is_callable_v<fn_object<QString>>, "Test function object");
-static_assert(returns<void, fn_object<QString>>(),
- "Test returns<> with function object");
-static_assert(!is_callable_v<fn_object<int>>, "Test non-function object");
-// FIXME: These two don't work
-// static_assert(is_callable_v<decltype(&fn_object<int>::smf)>,
-// "Test static member function");
-// static_assert(returns<int, decltype(&fn_object<int>::smf)>(),
-// "Test returns<> with static member function");
-
-template <typename T>
QString ft(T&&)
{
return {};