Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::experi...uture::then(3)  C++ Standard Libary std::experi...uture::then(3)

NAME
       std::experimental::shared_future::then  - std::experimental::shared_fu-
       ture::then

Synopsis
	  template < class F >
	  future</* see	below */> then(F&& func) const;

	  Attach the continuation func to *this. The behavior is undefined  if
       *this has no
	  associated shared state (i.e., valid() == false).

	  Creates  a  shared state associated with the future object to	be re-
       turned, and a copy
	  fd of	func constructed as  if	 by  DECAY_COPY(std::forward<F>(func))
       evaluated in the
	  thread calling then, where DECAY_COPY	is defined as

	  template <class T>
	  std::decay_t<T> DECAY_COPY(T&& v) {
	      return std::forward<T>(v);
	  }

	  When	the shared state currently associated with *this is ready, the
       continuation
	  INVOKE(std::move(fd),	*this) is called on an unspecified  thread  of
       execution, where
	  INVOKE  is  the operation defined in Callable. If that expression is
       invalid,	the
	  behavior is undefined.

	  Any value returned from the continuation is stored as	the result  in
       the shared state
	  of the returned future object. Any exception propagated from the ex-
       ecution of the
	  continuation is stored as the	exceptional result in the shared state
       of the returned
	  future object.

	  Let U	be the return type of the continuation (i.e.
	  std::result_of_t<std::decay_t<F>(const std::experimental::shared_fu-
       ture<T> &)>). If
	  U is std::experimental::future<T2> for some type T2, then the	return
       type of then is
	  std::experimental::future<T2>,   otherwise   it  is  std::experimen-
       tal::future<U>. This is
	  known	as implicit unwrapping.

	  If implicit unwrapping takes place and the continuation  returns  an
       invalid future,
	  then	the  shared  state  is	made  ready  with an exception of type
       std::future_error with
	  an error condition of	std::future_errc::broken_promise.

	  After	this function returns, valid() is true.

Parameters
	  func - A continuation	to be attached.

Return value
	  A std::experimental::future object associated	with the shared	 state
       created by this
	  object. valid() == true for the returned object.

Example
	   This	section	is incomplete
	   Reason: no example

http://cppreference.com		  2022.07.31	  std::experi...uture::then(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::experimental::shared_future::then&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help