diff options
author | HampusM <hampus@hampusmat.com> | 2022-04-10 17:20:49 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:58 +0200 |
commit | b36d072ad7a7b9c6e30fcb25d6bbb001a8393468 (patch) | |
tree | 7749fc877652bb2cf7bbd2b7c1fed5e3abe397fc /src/DI/strip_signature.hpp | |
parent | b828d4799a84beb1afbd889e5c4cb939a8b3df78 (diff) |
refactor: add factory class & make DI container return unique ptrs
Diffstat (limited to 'src/DI/strip_signature.hpp')
-rw-r--r-- | src/DI/strip_signature.hpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/DI/strip_signature.hpp b/src/DI/strip_signature.hpp new file mode 100644 index 0000000..9d20a87 --- /dev/null +++ b/src/DI/strip_signature.hpp @@ -0,0 +1,103 @@ +#pragma once + +template <class Function> +struct strip_signature; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...)> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) volatile> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const volatile> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) &> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const &> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) volatile &> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const volatile &> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) noexcept> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const noexcept> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) volatile noexcept> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const volatile noexcept> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) &noexcept> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const &noexcept> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) volatile &noexcept> +{ + using type = Return(Args...); +}; + +template <class Return, class Class, class... Args> +struct strip_signature<Return (Class::*)(Args...) const volatile &noexcept> +{ + using type = Return(Args...); +}; + +template <class Function> +using strip_signature_t = typename strip_signature<Function>::type; |