add_lvalue_reference.qbk 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. [/
  2. Copyright 2010 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_lvalue_reference add_lvalue_reference]
  8. template <class T>
  9. struct add_lvalue_reference
  10. {
  11. typedef __below type;
  12. };
  13. template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++11 and above
  14. __type If `T` names an object or function type then the member typedef `type`
  15. shall name `T&`; otherwise, if `T` names a type ['rvalue reference to U] then
  16. the member typedef type shall name `U&`; otherwise, type shall name `T`.
  17. __std_ref 20.7.6.2.
  18. __header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
  19. [table Examples
  20. [ [Expression] [Result Type]]
  21. [[`add_lvalue_reference<int>::type`][`int&`]]
  22. [[`add_lvalue_reference<int const&>::type`] [`int const&`]]
  23. [[`add_lvalue_reference<int*>::type`] [`int*&`]]
  24. [[`add_lvalue_reference<int*&>::type`] [`int*&`]]
  25. [[`add_lvalue_reference<int&&>::type`][`int&`]]
  26. [[`add_lvalue_reference<void>::type`][`void`]]
  27. ]
  28. [all_compilers]
  29. [endsect]