std::unwrap_reference, std::unwrap_ref_decay
Defined in header <functional> | ||
---|---|---|
template< class T > struct unwrap_reference; | (1) | (since C++20) |
template< class T > struct unwrap_ref_decay : std::unwrap_reference<std::decay_t<T>> {}; | (2) | (since C++20) |
1) If
T
is std::reference_wrapper<U>
for some type U
, provides a member typedef type
that names U&
; otherwise, provides a member typedef type
that names T
.
2) If
T
is std::reference_wrapper<U>
for some type U
, ignoring cv-qualification and referenceness, provides a member typedef type
that names U&
; otherwise, provides a member typedef type
that names std::decay_t<T>
.Member types
Name | Definition |
---|---|
type | 1) 2) |
Helper types
template<class T> using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type; | (since C++20) |
Possible implementation
template <class T> struct unwrap_reference { using type = T; }; template <class U> struct unwrap_reference<std::reference_wrapper<U>> { using type = U&; }; |
Notes
std::unwrap_ref_decay
performs the same transformation as used by std::make_pair
and std::make_tuple
.
Example
See also
(C++11) | CopyConstructible and CopyAssignable reference wrapper (class template) |
creates a pair object of type, defined by the argument types (function template) |
|
creates a tuple object of the type defined by the argument types (function template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/functional/unwrap_reference