50 auto p = std::promise<Try<A> >();
52 m_fta = p.get_future();
56 auto p = std::promise<Try<A> >();
58 m_fta = p.get_future();
62 auto p = std::promise<Try<A> >();
64 m_fta = p.get_future();
68 auto p = std::promise<Try<A> >();
70 m_fta = p.get_future();
74 auto p = std::promise<Try<A> >();
76 m_fta = p.get_future();
100 template <
typename F,
101 class = std::enable_if<
102 std::is_convertible<std::result_of<F()>,A>
::value,A> >
106 std::async(std::launch::async, [f](){
return try_(f); }));
113 template <
typename F,
115 #if __cplusplus >= 201402L
118 static std::function<Future<B>(
const Future<A>&)>
132 template <
typename F,
137 return map(std::forward<F>(fn)).flatten();
153 return fta.get().recoverWith(
154 [](
const std::exception_ptr&
e) {
164 template <
typename F,
169 return flatMap([fn](
const A&){
return fn(); });
176 template <
typename F,
183 return fn().map([a](
const typename FB::value_type &){
202 template <
typename P,
204 class = std::enable_if<
205 std::is_convertible<std::result_of<P(const A&)>,
bool>
::value>,
206 class = std::enable_if<
207 std::is_same<Future<A>,std::result_of<F(const A&)> >
::value> >
211 [p](
const A& a){
return !p(a); },
221 template <
typename P,
223 class = std::enable_if<
224 std::is_convertible<std::result_of<P(const A&)>,
bool>
::value>,
225 class = std::enable_if<
226 std::is_same<Future<A>,std::result_of<F(const A&)> >
::value> >
236 while (result.get().map(p).getOrElse_(
false))
237 result = result.flatMap(f);
246 template <
typename F,
254 [fta, fn](){
return fta.get().map(fn); }));
261 template <
typename F,
262 class = std::enable_if<
264 std::result_of<F(std::exception_ptr &)>,A>
::value> >
272 return fta.get().recoverWith(fn);
285 template <
class Rep,
class Period>
287 waitFor(
const std::chrono::duration<Rep,Period>& rel_time)
const {
288 return m_fta.wait_for(rel_time);
293 template <
class Clock,
class Duration>
295 waitUntil(
const std::chrono::time_point<Clock,Duration>& abs_time)
const {
296 return m_fta.wait_until(abs_time);
303 template <
typename F,
308 return flatMap(std::forward<F>(fn));
315 template <
typename F,
328 template <
typename F,
332 return map(std::forward<F>(fn));
341 template <
typename F,
Future(const std::exception_ptr &e)
FB followedBy(F fn) const
std::shared_future< Try< A > > m_fta
Future< A > future(F &&f)
virtual void move(double dx, double dy, casacore::String system="")
Implements RegionShape::move.
Future< A > iterateUntil(P p, F &&f) const
virtual casacore::String type() const
Implements RegionShape::type.
Future< A > recoverWith(F fn) const
Future(std::future< Try< A > > &&f)
NB: the following method would be erroneous, since calling std::future::share() is not const on std::...
Future< B > map(F fn) const
Future(const std::shared_future< Try< A > > &f)
static Future< A > from(F f)
Static methods.
FB operator>>=(F &&fn) const
std::future_status waitUntil(const std::chrono::time_point< Clock, Duration > &abs_time) const
FutureBase exists to enable tests in Future template methods of whether Future::value_type is a Futur...
Future< B > operator|(F &&fn) const
Future< A > iterateWhile(P p, F f) const
Future(std::shared_future< Try< A > > &&f)
FB flatMap(F &&fn) const
Instance methods.
Future< A > forEffect(F fn) const
static std::function< Future< B >const Future< A > &)> lift(F f)
std::future_status waitFor(const std::chrono::duration< Rep, Period > &rel_time) const
Future(std::exception_ptr &&e)
const Double e
e and functions thereof:
FB operator>>(F &&fn) const
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.