Replaced fc::deduce with std::remove_reference<std::remove_const<>>
This commit is contained in:
parent
0aac8a4afc
commit
8ad041cea0
4 changed files with 5 additions and 10 deletions
|
|
@ -96,7 +96,7 @@ namespace fc {
|
|||
template<typename Functor>
|
||||
auto do_parallel( Functor&& f, const char* desc FC_TASK_NAME_DEFAULT_ARG ) -> fc::future<decltype(f())> {
|
||||
typedef decltype(f()) Result;
|
||||
typedef typename fc::deduce<Functor>::type FunctorType;
|
||||
typedef typename std::remove_const_t< std::remove_reference_t<Functor> > FunctorType;
|
||||
typename task<Result,sizeof(FunctorType)>::ptr tsk =
|
||||
task<Result,sizeof(FunctorType)>::create( std::forward<Functor>(f), desc );
|
||||
tsk->retain(); // HERE BE DRAFONS
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <fc/thread/future.hpp>
|
||||
#include <fc/thread/priority.hpp>
|
||||
#include <fc/fwd.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace fc {
|
||||
struct context;
|
||||
|
|
@ -127,7 +128,7 @@ namespace fc {
|
|||
private:
|
||||
template<typename Functor>
|
||||
task( Functor&& f, const char* desc ):promise_base(desc), task_base(&_functor), promise<R>(desc) {
|
||||
typedef typename fc::deduce<Functor>::type FunctorType;
|
||||
typedef typename std::remove_const_t< std::remove_reference_t<Functor> > FunctorType;
|
||||
static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" );
|
||||
new ((char*)&_functor) FunctorType( std::forward<Functor>(f) );
|
||||
_destroy_functor = &detail::functor_destructor<FunctorType>::destroy;
|
||||
|
|
@ -155,7 +156,7 @@ namespace fc {
|
|||
private:
|
||||
template<typename Functor>
|
||||
task( Functor&& f, const char* desc ):promise_base(desc), task_base(&_functor), promise<void>(desc) {
|
||||
typedef typename fc::deduce<Functor>::type FunctorType;
|
||||
typedef typename std::remove_const_t< std::remove_reference_t<Functor> > FunctorType;
|
||||
static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" );
|
||||
new ((char*)&_functor) FunctorType( std::forward<Functor>(f) );
|
||||
_destroy_functor = &detail::functor_destructor<FunctorType>::destroy;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace fc {
|
|||
template<typename Functor>
|
||||
auto async( Functor&& f, const char* desc FC_TASK_NAME_DEFAULT_ARG, priority prio = priority()) -> fc::future<decltype(f())> {
|
||||
typedef decltype(f()) Result;
|
||||
typedef typename fc::deduce<Functor>::type FunctorType;
|
||||
typedef typename std::remove_const_t< std::remove_reference_t<Functor> > FunctorType;
|
||||
typename task<Result,sizeof(FunctorType)>::ptr tsk =
|
||||
task<Result,sizeof(FunctorType)>::create( std::forward<Functor>(f), desc );
|
||||
tsk->retain(); // HERE BE DRAFONS
|
||||
|
|
|
|||
|
|
@ -19,12 +19,6 @@ namespace fc {
|
|||
using std::size_t;
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
|
||||
template<typename T> struct deduce { typedef T type; };
|
||||
template<typename T> struct deduce<T&> { typedef T type; };
|
||||
template<typename T> struct deduce<const T&> { typedef T type; };
|
||||
template<typename T> struct deduce<T&&> { typedef T type; };
|
||||
template<typename T> struct deduce<const T&&>{ typedef T type; };
|
||||
|
||||
struct true_type { enum _value { value = 1 }; };
|
||||
struct false_type { enum _value { value = 0 }; };
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue