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

FreeBSD Manual Pages

  
 
  

home | help
std::refere...ence_wrapper(3) C++ Standard Libarystd::refere...ence_wrapper(3)

NAME
       std::reference_wrapper::reference_wrapper     -	  std::reference_wrap-
       per::reference_wrapper

Synopsis
	  template< class U >
	  reference_wrapper(  U&&  x  )	 noexcept(/*see			(until
       C++20)
	  below*/) ;
	  template< class U >
	  constexpr  reference_wrapper(	 U&&  x	 )		(1)	(since
       C++20)
	  noexcept(/*see below*/) ;
	  reference_wrapper(		 const		    reference_wrapper&
       (until C++20)
	  other	) noexcept;				       (2)
	  constexpr		     reference_wrapper(			 const
       (since C++20)
	  reference_wrapper& other ) noexcept;

	  Constructs a new reference wrapper.

	  1) Converts x	to T& as if by T& t = std::forward<U>(x);, then	stores
       a reference to
	  t. This overload participates	in overload resolution only  if	 type-
       name
	  std::decay<U>::type  is  not	the same type as reference_wrapper and
       the expression
	  FUN(std::declval<U>()) is well-formed, where FUN names  the  set  of
       imaginary
	  functions

	void FUN(T&) noexcept;
	void FUN(T&&) =	delete;

	  2) Copy constructor. Stores a	reference to other.get().

Parameters
	  x	- an object to wrap
	  other	- another reference wrapper

Exceptions
	  1)
	  noexcept specification:
	  noexcept(noexcept(FUN(std::declval<U>())))
	  where	 FUN  is  the  set of imaginary	functions described in the de-
       scription above.

Example
	   This	section	is incomplete
	   Reason: no example

	 Defect	reports

	  The following	behavior-changing defect reports were applied retroac-
       tively to
	  previously published C++ standards.

	     DR	      Applied	 to		 Behavior     as     published
       Correct behavior
			      deleted  reference_wrapper(T&&)  constructor re-
       placed with a
	  LWG 2993 C++11      interferes				  con-
       structor	template
			      with overload resolution in some cases

http://cppreference.com		  2022.07.31	 std::refere...ence_wrapper(3)

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

home | help