From f0883534b3303cf2b74f3ab51efe16615d2561a9 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 28 Feb 2022 19:45:21 +0100 Subject: refactor: move is_func to own type traits file --- src/DI/container.hpp | 16 +++------------- src/DI/type_traits.hpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 src/DI/type_traits.hpp (limited to 'src') diff --git a/src/DI/container.hpp b/src/DI/container.hpp index 6cb89ce..2dd194f 100644 --- a/src/DI/container.hpp +++ b/src/DI/container.hpp @@ -1,9 +1,9 @@ #pragma once +#include "DI/interfaces/wrapper.hpp" #include "DI/object_type.hpp" -#include "interfaces/wrapper.hpp" +#include "DI/type_traits.hpp" -#include #include #include #include @@ -26,16 +26,6 @@ private: Container *_container; }; -template -struct is_func : public std::false_type // NOLINT(readability-identifier-naming) -{ -}; - -template -struct is_func> : public std::true_type -{ -}; - class Container { public: @@ -47,7 +37,7 @@ public: template >> std::shared_ptr get() const; - template ::value>> + template >> Interface get() const; std::unordered_map, ObjectTypeHasher> 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 + +template +struct is_func : public std::false_type // NOLINT(readability-identifier-naming) +{ +}; + +template +struct is_func> : public std::true_type +{ +}; + +template +inline constexpr bool is_func_v = is_func::value; -- cgit v1.2.3-18-g5258