copy_reference.qbk 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. [/
  2. Copyright 2019 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License,
  5. Version 1.0. (See accompanying file LICENSE_1_0.txt
  6. or copy at http://www.boost.org/LICENSE_1_0.txt).
  7. ]
  8. [section:copy_reference copy_reference_]
  9. template<class T, class U>
  10. struct copy_reference
  11. {
  12. typedef __below type;
  13. };
  14. template<class T, class U>
  15. using copy_reference_t = typename copy_reference<T, U>::type;
  16. __type [^T /ref/], where /ref/ are the ref-qualifiers of `U`.
  17. __header `#include <boost/type_traits/copy_reference.hpp>` or
  18. `#include <boost/type_traits.hpp>>`
  19. [table Examples
  20. [[Expression] [Result Type]]
  21. [[`copy_reference<int, char>::type`][`int`]]
  22. [[`copy_reference<int, char&>::type`] [`int&`]]
  23. [[`copy_reference<int, char&&>::type`] [`int&&`]]
  24. [[`copy_reference<int&, char>::type`] [`int&`]]
  25. [[`copy_reference<int&, char&>::type`] [`int&`]]
  26. [[`copy_reference<int&, char&&>::type`] [`int&`]]
  27. [[`copy_reference<int&&, char>::type`] [`int&&`]]
  28. [[`copy_reference<int&&, char&>::type`] [`int&`]]
  29. [[`copy_reference<int&&, char&&>::type`] [`int&&`]]
  30. ]
  31. [all_compilers] The type alias `copy_reference_t` is only available if the compiler
  32. supports template aliases.
  33. [endsect]