-/* 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
#include <boost/variant.hpp>
#include <exception>
#include <functional>
+#include <future> // std::future_error
#include <stdexcept>
#include <type_traits>
#include <utility>
break;
}
default:
- throw std::logic_error("Invalid result");
+ throw std::future_error(std::future_errc::no_state);
}
}
+
private:
boost::variant<boost::blank, T, std::exception_ptr> value_;
};
}
}
-template <class P, class F> auto fulfill_promise(P& promise, F&& code) -> decltype(promise.set_value())
+template <class R, class F> auto fulfill_promise(R& promise, F&& code) -> decltype(promise.set_value())
{
try {
std::forward<F>(code)();