X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/65beede857f93e33c96e544f76b93793c973dc10..2e60fe3cfd5cf5305888fcca0ae19700d808bb23:/include/xbt/future.hpp diff --git a/include/xbt/future.hpp b/include/xbt/future.hpp index 95ab69d666..ac75bf6747 100644 --- a/include/xbt/future.hpp +++ b/include/xbt/future.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2019. The SimGrid Team. +/* Copyright (c) 2015-2020. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -12,6 +12,7 @@ #include #include #include +#include // std::future_error #include #include #include @@ -66,9 +67,10 @@ public: break; } default: - throw std::logic_error("Invalid result"); + throw std::future_error(std::future_errc::no_state); } } + private: boost::variant value_; }; @@ -126,7 +128,7 @@ template auto fulfill_promise(R& promise, F&& code) -> declty } } -template auto fulfill_promise(P& promise, F&& code) -> decltype(promise.set_value()) +template auto fulfill_promise(R& promise, F&& code) -> decltype(promise.set_value()) { try { std::forward(code)();