swift
Public Member Functions | List of all members
swift::misc::CPromise< T > Class Template Reference

A promise-based interface to QFuture, similar to std::promise for std::future. More...

Public Member Functions

QFuture< T > future ()
 Return a future that can be used to access the result.
 
void abandon ()
 Mark the result as cancelled.
 
void setResult (const T &value)
 Set the result value that will be made available through the future.
 
template<typename U >
void setResult (QFuture< U > future)
 Set the result value from the given future. Will block if future is not ready.
 
template<typename U >
void chainResult (QFuture< U > future)
 When the given future is ready, use its result to set the result of this promise.
 
template<typename F >
void setResultFrom (F &&func)
 Invoke a functor and use its return value to set the result. More...
 

Detailed Description

template<typename T>
class swift::misc::CPromise< T >

A promise-based interface to QFuture, similar to std::promise for std::future.

Definition at line 77 of file promise.h.

Member Function Documentation

◆ setResultFrom()

template<typename T >
template<typename F >
void swift::misc::CPromise< T >::setResultFrom ( F &&  func)
inline

Invoke a functor and use its return value to set the result.

Useful for uniform syntax in generic code where T could be void.

Definition at line 111 of file promise.h.


The documentation for this class was generated from the following file: