Class promise<void>
poet::promise<void> — A void specialization of the promise template class.
Synopsis
class promise<void> { public: // types typedef void value_type; // construct/copy/destruct promise(); promise(const promise &); template<typename OtherType> promise(const promise<OtherType> &); promise& operator=(const promise &); virtual ~promise(); // public member functions void fulfill(const future<void> &) ; void fulfill() ; bool has_future() const; void reset(); void swap(promise &); template<typename E> void renege(const E &); void renege(const poet::exception_ptr &); };
Description
promise<void> may be used to create future<void> objects which have no value. In addition, a promise<void> can be constructed from a promise<T> where T is any type. This allows a promise<void> to be used by code which only needs to be able to renege on a promise and not fulfill it.
promise
public construct/copy/destruct
-
promise();
Same as the corresponding constructor for an unspecialized
promise
. -
promise(const promise & other);
Same as the corresponding constructor for an unspecialized
promise
. -
template<typename OtherType> promise(const promise<OtherType> & other);
A promise<void> may be constructed from a promise with any template type, although it cannot fulfill such a promise. It can renege on the promise, however.
-
promise& operator=(const promise & rhs);
Assignment makes
*this
a shallow copy ofrhs
. -
virtual ~promise();
promise
public member functions
-
void fulfill(const future<void> & future_value) ;
Same as the corresponding function for an unspecialized
promise
. -
void fulfill() ;
Will make any future<void> objects referencing this promise become ready.
Throws:
std::invalid_argument -
bool has_future() const;
Same as the corresponding function for an unspecialized
promise
. -
void reset();
Same as the corresponding function for an unspecialized
promise
. -
void swap(promise & other);
Same as the corresponding function for an unspecialized
promise
. -
template<typename E> void renege(const E & exception); void renege(const poet::exception_ptr & exp);
Same as the corresponding function for an unspecialized
promise
.