add_pointer.qbk 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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:add_pointer add_pointer]
  8. template <class T>
  9. struct add_pointer
  10. {
  11. typedef __below type;
  12. };
  13. template <class T> using add_pointer_t = typename add_pointer<T>::type; // C++11 and above
  14. __type The same type as `remove_reference<T>::type*`.
  15. The rationale for this template
  16. is that it produces the same type as `decltype(&t)`,
  17. where `t` is an object of type `T`.
  18. __std_ref 8.3.1.
  19. __header ` #include <boost/type_traits/add_pointer.hpp>` or ` #include <boost/type_traits.hpp>`
  20. [table Examples
  21. [ [Expression] [Result Type]]
  22. [[`add_pointer<int>::type`][`int*`]]
  23. [[`add_pointer<int const&>::type`] [`int const*`]]
  24. [[`add_pointer<int*>::type`] [`int**`]]
  25. [[`add_pointer<int*&>::type`] [`int**`]]
  26. ]
  27. [all_compilers]
  28. [endsect]