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

FreeBSD Manual Pages

  
 
  

home | help
deductiongu...ckaged_task(3)  C++ Standard Libary deductiongu...ckaged_task(3)

NAME
       deductionguidesforstd::packaged_task   -	  deductionguidesforstd::pack-
       aged_task

Synopsis
	  Defined in header <future>
	  template< class R,  class...	Args  >				   (1)
       (since C++17)
	  packaged_task( R(*)(Args...) ) -> packaged_task<R(Args...)>;
	  template<  class  F  >					   (2)
       (since C++17)
	  packaged_task( F ) ->	packaged_task</*see below*/>;
	  template<  class  F  >					   (3)
       (since C++23)
	  packaged_task( F ) ->	packaged_task</*see below*/>;
	  template<  class  F  >					   (4)
       (since C++23)
	  packaged_task( F ) ->	packaged_task</*see below*/>;

	  1) This deduction guide is provided for std::packaged_task to	 allow
       deduction from
	  functions.
	  2) This overload participates	in overload resolution only if &F::op-
       erator()	is
	  well-formed	when   treated	as  an	unevaluated  operand  and  de-
       cltype(&F::operator()) is
	  of the form R(G::*)(A...) (optionally	cv-qualified, optionally noex-
       cept, optionally
	  lvalue  reference  qualified).  The  deduced	type   is   std::pack-
       aged_task<R(A...)>.
	  3) This overload participates	in overload resolution only if &F::op-
       erator()	is
	  well-formed when treated as an unevaluated operand and F::operator()
       is an explicit
	  object  parameter  function whose type is of form R(G, A...) or R(G,
       A...) noexcept.
	  The deduced type is std::packaged_task<R(A...)>.
	  4) This overload participates	in overload resolution only if &F::op-
       erator()	is
	  well-formed when treated as an unevaluated operand and F::operator()
       is a static
	  member function whose	type is	of form	R(A...)	or  R(A...)  noexcept.
       The deduced type
	  is std::packaged_task<R(A...)>.

Notes
	  These	 deduction  guides do not allow	deduction from a function with
       ellipsis
	  parameter, and the ... in the	types is always	treated	as a pack  ex-
       pansion.

Example
       // Run this code

	#include <future>

	int func(double) { return 0; }

	int main()
	{
	    std::packaged_task f{func};	// deduces packaged_task<int(double)>

	    int	i = 5;
	    std::packaged_task	g  =  [&](double)  {  return i;	}; // => pack-
       aged_task<int(double)>
	}

http://cppreference.com		  2024.06.10	  deductiongu...ckaged_task(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=deductionguidesforstd::packaged_task&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help