aboutsummaryrefslogtreecommitdiff
path: root/src/DI
diff options
context:
space:
mode:
Diffstat (limited to 'src/DI')
-rw-r--r--src/DI/container.hpp2
-rw-r--r--src/DI/function_wrapper.hpp2
-rw-r--r--src/DI/function_wrapper.tpp5
-rw-r--r--src/DI/type_traits.hpp4
4 files changed, 9 insertions, 4 deletions
diff --git a/src/DI/container.hpp b/src/DI/container.hpp
index 2dd194f..93722b6 100644
--- a/src/DI/container.hpp
+++ b/src/DI/container.hpp
@@ -34,7 +34,7 @@ public:
template <class Interface>
BindingBuilder<Interface> bind();
- template <class Interface, class = std::enable_if_t<std::is_abstract_v<Interface>>>
+ template <class Interface, class = std::enable_if_t<std::is_class_v<Interface>>>
std::shared_ptr<Interface> get() const;
template <typename Interface, typename = std::enable_if_t<is_func_v<Interface>>>
diff --git a/src/DI/function_wrapper.hpp b/src/DI/function_wrapper.hpp
index e4b6779..716668c 100644
--- a/src/DI/function_wrapper.hpp
+++ b/src/DI/function_wrapper.hpp
@@ -9,7 +9,7 @@ template <class Interface>
class FunctionWrapper : public IWrapper<Interface>
{
public:
- explicit FunctionWrapper(Interface func) : _func(func) {}
+ explicit FunctionWrapper(Interface func) noexcept;
[[nodiscard]] Interface get() const;
diff --git a/src/DI/function_wrapper.tpp b/src/DI/function_wrapper.tpp
index 4e09957..920c7f2 100644
--- a/src/DI/function_wrapper.tpp
+++ b/src/DI/function_wrapper.tpp
@@ -3,6 +3,11 @@
#include "function_wrapper.hpp"
template <class Interface>
+FunctionWrapper<Interface>::FunctionWrapper(Interface func) noexcept : _func(func)
+{
+}
+
+template <class Interface>
Interface FunctionWrapper<Interface>::get() const
{
return _func;
diff --git a/src/DI/type_traits.hpp b/src/DI/type_traits.hpp
index a852a4f..e4b6640 100644
--- a/src/DI/type_traits.hpp
+++ b/src/DI/type_traits.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include <functional>
+#include <type_traits>
template <typename NotAFunc>
struct is_func : public std::false_type // NOLINT(readability-identifier-naming)
@@ -8,7 +8,7 @@ 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
+struct is_func<Return (*)(Args...)> : public std::true_type
{
};