aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
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.h
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.h')
-rw-r--r--lib/util.h22
1 files changed, 4 insertions, 18 deletions
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<void, T> {};
// Specialisation for a function
template <typename ReturnT, typename... ArgTs>
struct function_traits<ReturnT(ArgTs...)> {
- static constexpr auto is_callable = true;
using return_type = ReturnT;
using arg_types = std::tuple<ArgTs...>;
- using function_type = std::function<ReturnT(ArgTs...)>;
- static constexpr auto arg_number = std::tuple_size<arg_types>::value;
};
namespace _impl {
template <typename AlwaysVoid, typename T>
- 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 <typename T>
struct fn_traits<decltype(void(&T::operator())), T>
- : public fn_traits<void, decltype(&T::operator())> {
- }; // A generic function object that has (non-overloaded) operator()
+ : public fn_traits<void, decltype(&T::operator())> {};
// Specialisation for a member function
template <typename ReturnT, typename ClassT, typename... ArgTs>
@@ -190,16 +186,6 @@ template <typename FnT, int ArgN = 0>
using fn_arg_t =
std::tuple_element_t<ArgN, typename function_traits<FnT>::arg_types>;
-template <typename R, typename FnT>
-constexpr bool returns()
-{
- return std::is_same<fn_return_t<FnT>, R>::value;
-}
-
-// Poor-man's is_invokable
-template <typename T>
-constexpr auto is_callable_v = function_traits<T>::is_callable;
-
inline auto operator"" _ls(const char* s, std::size_t size)
{
return QLatin1String(s, int(size));