Fix compiler warning

This commit is contained in:
Vikram Rajkumar 2014-07-27 20:46:39 -04:00
parent d847f6469a
commit f644b1e475

View file

@ -61,7 +61,7 @@ namespace fc {
class task : virtual public task_base, virtual public promise<R> { class task : virtual public task_base, virtual public promise<R> {
public: public:
template<typename Functor> template<typename Functor>
task( Functor&& f, const char* desc ):task_base(&_functor), promise_base(desc), promise<R>(desc) { task( Functor&& f, const char* desc ):promise_base(desc), task_base(&_functor), promise<R>(desc) {
typedef typename fc::deduce<Functor>::type FunctorType; typedef typename fc::deduce<Functor>::type FunctorType;
static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" ); static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" );
new ((char*)&_functor) FunctorType( fc::forward<Functor>(f) ); new ((char*)&_functor) FunctorType( fc::forward<Functor>(f) );
@ -74,11 +74,12 @@ namespace fc {
private: private:
~task(){} ~task(){}
}; };
template<uint64_t FunctorSize> template<uint64_t FunctorSize>
class task<void,FunctorSize> : virtual public task_base, virtual public promise<void> { class task<void,FunctorSize> : virtual public task_base, virtual public promise<void> {
public: public:
template<typename Functor> template<typename Functor>
task( Functor&& f, const char* desc ):task_base(&_functor), promise_base(desc), promise<void>(desc) { task( Functor&& f, const char* desc ):promise_base(desc), task_base(&_functor), promise<void>(desc) {
typedef typename fc::deduce<Functor>::type FunctorType; typedef typename fc::deduce<Functor>::type FunctorType;
static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" ); static_assert( sizeof(f) <= sizeof(_functor), "sizeof(Functor) is larger than FunctorSize" );
new ((char*)&_functor) FunctorType( fc::forward<Functor>(f) ); new ((char*)&_functor) FunctorType( fc::forward<Functor>(f) );
@ -93,4 +94,3 @@ namespace fc {
}; };
} }