deduction guides for std::reference_wrapper

From cppreference.com
 
 
 
Function objects
Function wrappers
(C++11)
(C++11)
Bind
(C++11)
Function invocation
(C++17)
Reference wrappers
(C++11)(C++11)
Operator wrappers
Negators
(deprecated)
(deprecated)

(deprecated)
(deprecated)
Searchers
Old binders and adaptors
(until C++17)
(until C++17)
(until C++17)
(until C++17)
(until C++17)(until C++17)(until C++17)(until C++17)
(until C++17)(until C++17)
(until C++17)(until C++17)

(until C++17)
(until C++17)(until C++17)(until C++17)(until C++17)
 
 
Defined in header <functional>
template<typename T>
reference_wrapper(T&) -> reference_wrapper<T>;
(since C++20)

One deduction guide is provided for std::reference_wrapper to support deduction of the sole class template parameter.

Notes

In C++17 this support is provided via the reference_wrapper(T&) constructor, but that constructor is removed in C++20 in favor of a constructor template that does not support class template argument deduction, necessitating a separate deduction guide.

Example

Defect reports

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

DR Applied to Behavior as published Correct behavior
LWG 2981 C++17 a redundant deduction guide from reference_wrapper<T> was provided removed