From 70b21e90d7be4d892b7d17440d64630e7ee1a575 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 3 Mar 2022 19:17:48 +0100 Subject: refactor: improve factories --- src/DI/container.hpp | 2 +- src/DI/function_wrapper.hpp | 2 +- src/DI/function_wrapper.tpp | 5 +++++ src/DI/type_traits.hpp | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/DI') 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 BindingBuilder bind(); - template >> + template >> std::shared_ptr get() const; template >> 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 FunctionWrapper : public IWrapper { 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 @@ -2,6 +2,11 @@ #include "function_wrapper.hpp" +template +FunctionWrapper::FunctionWrapper(Interface func) noexcept : _func(func) +{ +} + template Interface FunctionWrapper::get() const { 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 +#include template 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 -struct is_func> : public std::true_type +struct is_func : public std::true_type { }; -- cgit v1.2.3-18-g5258