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

NAME
     std::reference_wrapper::reference_wrapper	- std::reference_wrapper::refer-
     ence_wrapper

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

	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 typename
	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 imagi-
     nary
	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 description
     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 replaced
     with a
	LWG 2993 C++11	    interferes				       construc-
     tor template
			    with overload resolution in some cases

Categories:
	  * conditionally noexcept
	  * Todo no example

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

home | help