template< class T >
struct decay;
Performs the type conversions equivalent to the ones performed when passing function arguments by value. Formally:
T
is âarray of U
â or reference to it, the member typedef type
is U*
.T
is a function type F
or reference to one, the member typedef type
is std::add_pointer<F>::type.type
is std::remove_cv<std::remove_reference<T>::type>::type.If the program adds specializations for std::decay
, the behavior is undefined.
type
the result of applying the decay type conversions to T
[edit] Helper types
template< class T >
using decay_t = typename decay<T>::type;
#include <type_traits> template<typename T, typename U> constexpr bool is_decay_equ = std::is_same_v<std::decay_t<T>, U>; static_assert ( is_decay_equ<int, int> && ! is_decay_equ<int, float> && is_decay_equ<int&, int> && is_decay_equ<int&&, int> && is_decay_equ<const int&, int> && is_decay_equ<int[2], int*> && ! is_decay_equ<int[4][2], int*> && ! is_decay_equ<int[4][2], int**> && is_decay_equ<int[4][2], int(*)[2]> && is_decay_equ<int(int), int(*)(int)> ); int main() {}[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4