Showing posts with label cpp11_decay. Show all posts
Showing posts with label cpp11_decay. Show all posts

Jul 12, 2016

[C++] decay

std::decay



Applies lvalue-to-rvalue, array-to-pointer, and function-to-pointer implicit conversions to the type T, removes cv-qualifiers, and defines the resulting type as the member typedef type.
Formally:
  • If T names the type "array of U" or "reference to array of U", the member typedef type is U*.
  • Otherwise, if T is a function type F or a reference thereto, the member typedef type is std::add_pointer<F>::type. 
  • Otherwise, the member typedef type is std::remove_cv<std::remove_reference<T>::type>::type.
These conversions model the type conversion applied to all function arguments when passed by value.