aboutsummaryrefslogtreecommitdiff
path: root/src/DI/type_traits.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-02-28 19:45:21 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:54 +0200
commitf0883534b3303cf2b74f3ab51efe16615d2561a9 (patch)
treec1dfb0d47afb60a6117234431fe6b457e42e6ae5 /src/DI/type_traits.hpp
parent522c446c801e62d360480744a6e89d91dd840c95 (diff)
refactor: move is_func to own type traits file
Diffstat (limited to 'src/DI/type_traits.hpp')
-rw-r--r--src/DI/type_traits.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/DI/type_traits.hpp b/src/DI/type_traits.hpp
new file mode 100644
index 0000000..a852a4f
--- /dev/null
+++ b/src/DI/type_traits.hpp
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <functional>
+
+template <typename NotAFunc>
+struct is_func : public std::false_type // NOLINT(readability-identifier-naming)
+{
+};
+
+template <typename Return, typename... Args>
+struct is_func<std::function<Return(Args...)>> : public std::true_type
+{
+};
+
+template <typename PossiblyFunc>
+inline constexpr bool is_func_v = is_func<PossiblyFunc>::value;