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

  1. promise();

    Same as the corresponding constructor for an unspecialized promise.

  2. promise(const promise & other);

    Same as the corresponding constructor for an unspecialized promise.

  3. 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.

  4. promise& operator=(const promise & rhs);

    Assignment makes *this a shallow copy of rhs.

  5. virtual ~promise();

promise public member functions

  1. void fulfill(const future<void> & future_value) ;

    Same as the corresponding function for an unspecialized promise.

  2. void fulfill() ;

    Will make any future<void> objects referencing this promise become ready.

    Throws:

    std::invalid_argument
  3. bool has_future() const;

    Same as the corresponding function for an unspecialized promise.

  4. void reset();

    Same as the corresponding function for an unspecialized promise.

  5. void swap(promise & other);

    Same as the corresponding function for an unspecialized promise.

  6. template<typename E> void renege(const E & exception);
    void renege(const poet::exception_ptr & exp);

    Same as the corresponding function for an unspecialized promise.