Class future<void>

poet::future<void> — A void specialization of the future template class.

Synopsis

class future<void> {
public:
  // types
  typedef void value_type;

  // construct/copy/destruct
  future(const promise<void> &);
  template<typename OtherType> future(const promise<OtherType> &);
  future(const future &);
  template<typename OtherType> future(const future<OtherType> &);
  future();
  future& operator=(const future &);
  template<typename OtherType> future& operator=(const future<OtherType> &);
  virtual ~future();

  // public member functions
  void get() const;
  operator void() const;
  void join() const;
  bool timed_join(const boost::system_time &) const;
  bool ready() const;
  bool has_exception() const;
  void swap(future &);
};

Description

future<void> is for futures with no value. For example, it may be used to wait on the completion of an asynchronous function which has no return value. In addition, a future<void> can assigned or constructed from a future<T> where T is any type. This allows a future<void> to be used by code which is only interested in whether the future is ready or has an exception, and is not interested in the future's specific value or template type.

future public construct/copy/destruct

  1. future(const promise<void> & promise_in);

    Same as the corresponding constructor for an unspecialized future.

  2. template<typename OtherType> future(const promise<OtherType> & promise);

    A future<void> can be constructed from any type of promise.

  3. future(const future & other);

    Same as the corresponding constructor for an unspecialized future.

  4. template<typename OtherType> future(const future<OtherType> & other);

    A future<void> can be constructed from any type of future.

  5. future();

    Same as the corresponding function for an unspecialized future.

  6. future& operator=(const future & rhs);

    Same as the corresponding function for an unspecialized future.

  7. template<typename OtherType> 
      future& operator=(const future<OtherType> & other);

    A future<void> can be assigned any type of future.

  8. virtual ~future();

future public member functions

  1. void get() const;

    A future<void> has no value, but get() can still be used to block until the future's promise is fulfilled or reneged.

  2. operator void() const;

    The conversion operator has the same effects as the explicit get() function.

  3. void join() const;

    Same as the corresponding function for an unspecialized future.

  4. bool timed_join(const boost::system_time & absolute_time) const;

    Same as the corresponding function for an unspecialized future.

  5. bool ready() const;

    Same as the corresponding function for an unspecialized future.

  6. bool has_exception() const;

    Same as the corresponding function for an unspecialized future.

  7. void swap(future & other);

    Swaps *this with other.