From 8ad041cea02ebe722d29aa82e887e9aa7a2591c1 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 3 Jun 2019 12:21:50 +0200 Subject: [PATCH] Replaced fc::deduce with std::remove_reference> --- include/fc/thread/parallel.hpp | 2 +- include/fc/thread/task.hpp | 5 +++-- include/fc/thread/thread.hpp | 2 +- include/fc/utility.hpp | 6 ------ 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/fc/thread/parallel.hpp b/include/fc/thread/parallel.hpp index a1eece5..6ad88c2 100644 --- a/include/fc/thread/parallel.hpp +++ b/include/fc/thread/parallel.hpp @@ -96,7 +96,7 @@ namespace fc { template auto do_parallel( Functor&& f, const char* desc FC_TASK_NAME_DEFAULT_ARG ) -> fc::future { typedef decltype(f()) Result; - typedef typename fc::deduce::type FunctorType; + typedef typename std::remove_const_t< std::remove_reference_t > FunctorType; typename task::ptr tsk = task::create( std::forward(f), desc ); tsk->retain(); // HERE BE DRAFONS diff --git a/include/fc/thread/task.hpp b/include/fc/thread/task.hpp index db5bc66..3da124d 100644 --- a/include/fc/thread/task.hpp +++ b/include/fc/thread/task.hpp @@ -2,6 +2,7 @@ #include #include #include +#include namespace fc { struct context; @@ -127,7 +128,7 @@ namespace fc { private: template task( Functor&& f, const char* desc ):promise_base(desc), task_base(&_functor), promise(desc) { - typedef typename fc::deduce::type FunctorType; + typedef typename std::remove_const_t< std::remove_reference_t > FunctorType; static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" ); new ((char*)&_functor) FunctorType( std::forward(f) ); _destroy_functor = &detail::functor_destructor::destroy; @@ -155,7 +156,7 @@ namespace fc { private: template task( Functor&& f, const char* desc ):promise_base(desc), task_base(&_functor), promise(desc) { - typedef typename fc::deduce::type FunctorType; + typedef typename std::remove_const_t< std::remove_reference_t > FunctorType; static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" ); new ((char*)&_functor) FunctorType( std::forward(f) ); _destroy_functor = &detail::functor_destructor::destroy; diff --git a/include/fc/thread/thread.hpp b/include/fc/thread/thread.hpp index eb54959..2e275e6 100644 --- a/include/fc/thread/thread.hpp +++ b/include/fc/thread/thread.hpp @@ -86,7 +86,7 @@ namespace fc { template auto async( Functor&& f, const char* desc FC_TASK_NAME_DEFAULT_ARG, priority prio = priority()) -> fc::future { typedef decltype(f()) Result; - typedef typename fc::deduce::type FunctorType; + typedef typename std::remove_const_t< std::remove_reference_t > FunctorType; typename task::ptr tsk = task::create( std::forward(f), desc ); tsk->retain(); // HERE BE DRAFONS diff --git a/include/fc/utility.hpp b/include/fc/utility.hpp index c08160c..7c7983c 100644 --- a/include/fc/utility.hpp +++ b/include/fc/utility.hpp @@ -19,12 +19,6 @@ namespace fc { using std::size_t; typedef decltype(nullptr) nullptr_t; - template struct deduce { typedef T type; }; - template struct deduce { typedef T type; }; - template struct deduce { typedef T type; }; - template struct deduce { typedef T type; }; - template struct deduce{ typedef T type; }; - struct true_type { enum _value { value = 1 }; }; struct false_type { enum _value { value = 0 }; };