namespace xbt {
template <class F> class MainFunction {
-private:
F code_;
std::shared_ptr<const std::vector<std::string>> args_;
*/
template<class R, class... Args>
class Task<R(Args...)> {
-private:
-
// Placeholder for some class type:
struct whatever {};
}
private:
-
template<class F>
typename std::enable_if<canSBO<F>()>::type
init(F code)
{
const static TaskVtable vtable {
// Call:
- [](TaskUnion& buffer, Args... args) {
+ [](TaskUnion& buffer, Args&&... args) {
F* src = reinterpret_cast<F*>(&buffer);
F code = std::move(*src);
src->~F();
{
const static TaskVtable vtable {
// Call:
- [](TaskUnion& buffer, Args... args) {
+ [](TaskUnion& buffer, Args&&... args) {
// Delete F when we go out of scope:
std::unique_ptr<F> code(*reinterpret_cast<F**>(&buffer));
return (*code)(std::forward<Args>(args)...);
operator bool() const { return vtable_ != nullptr; }
bool operator!() const { return vtable_ == nullptr; }
- R operator()(Args... args)
+ R operator()(Args&&... args)
{
if (vtable_ == nullptr)
throw std::bad_function_call();
template<class F, class... Args>
class TaskImpl {
-private:
F code_;
std::tuple<Args...> args_;
typedef decltype(simgrid::xbt::apply(std::move(code_), std::move(args_))) result_type;