1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- [/
- Copyright 2007 John Maddock.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
- ]
- [section:add_reference add_reference]
- [note This trait has been made obsolete by __add_lvalue_reference and __add_rvalue_reference,
- and new code should use these new traits rather than __is_reference which is retained
- for backwards compatibility only.
- ]
- template <class T>
- struct add_reference
- {
- typedef __below type;
- };
- template <class T> using add_reference_t = typename add_reference<T>::type; // C++11 and above
-
- __type If `T` is not a reference type then `T&`, otherwise `T`.
- __std_ref 8.3.2.
- __header ` #include <boost/type_traits/add_reference.hpp>` or ` #include <boost/type_traits.hpp>`
- [table Examples
- [ [Expression] [Result Type]]
- [[`add_reference<int>::type`][`int&`]]
- [[`add_reference<int const&>::type`] [`int const&`]]
- [[`add_reference<int*>::type`] [`int*&`]]
- [[`add_reference<int*&>::type`] [`int*&`]]
- ]
- [all_compilers]
- [endsect]
|