type_identity.qbk 709 B

123456789101112131415161718192021222324252627282930313233
  1. [/
  2. Copyright 2015 Peter Dimov.
  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:type_identity type_identity]
  8. template <class T>
  9. struct type_identity
  10. {
  11. typedef T type;
  12. };
  13. template <class T> using type_identity_t = typename type_identity<T>::type; // C++11 and above
  14. __header ` #include <boost/type_traits/type_identity.hpp>` or ` #include <boost/type_traits.hpp>`
  15. [table Examples
  16. [ [Expression] [Result Type]]
  17. [[`type_identity<int>::type`][`int`]]
  18. [[`type_identity<int&>::type`] [`int&`]]
  19. [[`type_identity<int* const&>::type`] [`int* const&`]]
  20. ]
  21. [endsect]