From 7578eb6f79afbb421298088ee53da620eb04037f Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 2 Jun 2022 20:50:28 +0200 Subject: refactor: rename .tpp files to end with _impl.hpp --- src/util/function.tpp | 76 --------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 src/util/function.tpp (limited to 'src/util/function.tpp') diff --git a/src/util/function.tpp b/src/util/function.tpp deleted file mode 100644 index 9d3d38c..0000000 --- a/src/util/function.tpp +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include "function.hpp" - -#include - -template -struct remove_cv_seq; - -template -struct remove_cv_seq -{ - using type = Return(Args...); -}; - -template -struct remove_cv_seq -{ - using type = Return(Args...); -}; - -template -struct remove_cv_seq -{ - using type = Return(Args...); -}; - -template -constexpr inline auto extract_signature(Function * /*unused*/) noexcept -{ - return Signature::type>(); -} - -template -constexpr inline auto extract_signature(Function Class::* /*unused*/) noexcept -{ - return Signature::type>(); -} - -template -constexpr inline auto extract_signature(Function const & /*unused*/) noexcept - -> decltype(&Function::operator(), extract_signature(&Function::operator())) -{ - return extract_signature(&Function::operator()); -} - -template -inline auto -get_normalized_lambda(Function &&func, Signature /*unused*/) noexcept -{ - // Static copy of func. This will make it accessible for the lambda without using a - // lamda capture - static auto static_func = Function(std::forward(func)); - - return +[](Args... args) noexcept( - noexcept(std::declval()(std::forward(args)...))) -> Return - { - return static_func(std::forward(args)...); - }; -} - -/** - * Normalizes the type signature of a lambda function. - * - * This will make a lambda with captures passable to other functions. - * - * @param func A lambda function - * @returns The lambda function normalized. - */ -template -constexpr auto normalize_lambda(Function &&func) noexcept -{ - return get_normalized_lambda( - std::forward(func), - extract_signature(std::forward(func))); -} -- cgit v1.2.3-18-g5258