X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cff982bd049d26d7acbd0e23324e0de051b06d0d..b592b5aa6acbd39d705426f2b275ee8736548d0d:/include/simgrid/kernel/future.hpp diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index 4428b6e46a..e3a24687ac 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2020. The SimGrid Team. +/* Copyright (c) 2016-2021. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -17,7 +17,7 @@ #include #include -#include +#include namespace simgrid { namespace kernel { @@ -116,8 +116,7 @@ protected: **/ void resolve() { - if (status_ != FutureStatus::ready) - xbt_die("Deadlock: this future is not ready"); + xbt_assert(status_ == FutureStatus::ready, "Deadlock: this future is not ready"); status_ = FutureStatus::done; if (exception_) { std::exception_ptr exception = std::move(exception_); @@ -279,7 +278,6 @@ class Future { public: Future() = default; explicit Future(std::shared_ptr> state) : state_(std::move(state)) {} - ~Future() = default; // Move type: Future(Future&) = delete; @@ -358,19 +356,16 @@ public: * @exception std::future_error no state is associated with the future */ template - auto then(F continuation) -> typename std::enable_if::value, - Future>::type + auto then(F continuation) -> typename std::enable_if_t::value, + Future> { return this->then_no_unwrap(std::move(continuation)); } /** Attach a continuation to this future (future chaining) */ - template - auto then(F continuation) - -> typename std::enable_if< - is_future::value, - decltype(continuation(std::move(*this))) - >::type + template + auto then(F continuation) -> typename std::enable_if_t::value, + decltype(continuation(std::move(*this)))> { return unwrap_future(this->then_no_unwrap(std::move(continuation))); }