decay.qbk 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. [/
  2. Copyright 2007 John Maddock.
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ]
  7. [section:decay decay]
  8. template <class T>
  9. struct decay
  10. {
  11. typedef __below type;
  12. };
  13. template <class T> using decay_t = typename decay<T>::type; // C++11 and above
  14. __type Let `U` be the result of `remove_reference<T>::type`, then if `U` is
  15. an array type, the result is `remove_extent<U>::type*`, otherwise if `U` is a
  16. function type then the result is `U*`, otherwise the result is `remove_cv<U>::type`.
  17. __std_ref 3.9.1.
  18. __header ` #include <boost/type_traits/decay.hpp>` or ` #include <boost/type_traits.hpp>`
  19. [table Examples
  20. [ [Expression] [Result Type]]
  21. [[`decay<int[2][3]>::type`][`int[3]*`]]
  22. [[`decay<int(&)[2]>::type`] [`int*`]]
  23. [[`decay<int(&)(double)>::type`] [`int(*)(double)`]]
  24. [[`int(*)(double)`] [`int(*)(double)`]]
  25. [[`int(double)`] [`int(*)(double)`]]
  26. ]
  27. [all_compilers]
  28. [endsect]