blob: b3be371bc9fb1f9bc5daf9e121a9c0e1748dfaf5 [file] [log] [blame]
Brian Silverman4a2409e2018-08-04 23:24:02 -07001[/
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
8[section:add_lvalue_reference add_lvalue_reference]
9
10 template <class T>
11 struct add_lvalue_reference
12 {
13 typedef __below type;
14 };
15
16 template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++11 and above
17
18__type If `T` names an object or function type then the member typedef `type`
19shall name `T&`; otherwise, if `T` names a type ['rvalue reference to U] then
20the member typedef type shall name `U&`; otherwise, type shall name `T`.
21
22__std_ref 20.7.6.2.
23
24__header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
25
26[table Examples
27
28[ [Expression] [Result Type]]
29
30[[`add_lvalue_reference<int>::type`][`int&`]]
31
32[[`add_lvalue_reference<int const&>::type`] [`int const&`]]
33
34[[`add_lvalue_reference<int*>::type`] [`int*&`]]
35
36[[`add_lvalue_reference<int*&>::type`] [`int*&`]]
37
38[[`add_lvalue_reference<int&&>::type`][`int&`]]
39
40[[`add_lvalue_reference<void>::type`][`void`]]
41
42]
43
44[all_compilers]
45
46[endsect]
47