From ade7b92ec31896f0bab598da44ad4c1f1d235060 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Mon, 27 Jun 2016 15:38:31 +0200 Subject: [PATCH] Fix compilation --- include/xbt/functional.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index 9849224987..0a07a96c37 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -37,7 +37,7 @@ public: code_(std::move(code)), args_(std::make_shared>(std::move(args))) {} - int operator()() const + void operator()() const { const int argc = args_->size(); std::vector args = *args_; @@ -45,7 +45,7 @@ public: for (int i = 0; i != argc; ++i) argv[i] = args[i].empty() ? const_cast(""): &args[i].front(); argv[argc] = nullptr; - return code_(argc, argv.get()); + code_(argc, argv.get()); } }; @@ -145,10 +145,16 @@ namespace bits { template constexpr bool isUsableDirectlyInTask() { + // TODO, detect availability std::is_trivially_copyable / workaround +#if 1 + // std::is_trivially_copyable is not available before GCC 5. + return false; +#else // The only types we can portably store directly in the Task are the // trivially copyable ones (we can memcpy) which are small enough to fit: return std::is_trivially_copyable::value && sizeof(F) <= sizeof(bits::any_callback); +#endif } } @@ -267,6 +273,11 @@ public: vtable_ = &vtable; } + // TODO, Task(funcptr) + // TODO, Task(funcptr, data) + // TODO, Task(method, object) + // TODO, Task(stateless lambda) + operator bool() const { return vtable_ != nullptr; } bool operator!() const { return vtable_ == nullptr; } -- 2.20.1