add_rvalue_reference.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>add_rvalue_reference</title>
  5. <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
  8. <link rel="up" href="../reference.html" title="Alphabetical Reference">
  9. <link rel="prev" href="add_reference.html" title="add_reference">
  10. <link rel="next" href="add_volatile.html" title="add_volatile">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="add_reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_volatile.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h3 class="title">
  27. <a name="boost_typetraits.reference.add_rvalue_reference"></a><a class="link" href="add_rvalue_reference.html" title="add_rvalue_reference">add_rvalue_reference</a>
  28. </h3></div></div></div>
  29. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  30. <span class="keyword">struct</span> <span class="identifier">add_rvalue_reference</span>
  31. <span class="special">{</span>
  32. <span class="keyword">typedef</span> <em class="replaceable"><code>see-below</code></em> <span class="identifier">type</span><span class="special">;</span>
  33. <span class="special">};</span>
  34. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">using</span> <span class="identifier">add_rvalue_reference_t</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span> <span class="comment">// C++11 and above</span>
  35. </pre>
  36. <p>
  37. <span class="bold"><strong>type:</strong></span> If <code class="computeroutput"><span class="identifier">T</span></code>
  38. names an object or function type then the member typedef type shall name
  39. <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;&amp;</span></code>;
  40. otherwise, type shall name <code class="computeroutput"><span class="identifier">T</span></code>.
  41. <span class="emphasis"><em>[Note: This rule reflects the semantics of reference collapsing.
  42. For example, when a type <code class="computeroutput"><span class="identifier">T</span></code>
  43. names a type U&amp;, the type <code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is not an rvalue reference. -end note]</em></span>.
  44. </p>
  45. <p>
  46. <span class="bold"><strong>C++ Standard Reference:</strong></span> 20.7.6.2.
  47. </p>
  48. <p>
  49. <span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
  50. <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_rvalue_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
  51. or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
  52. </p>
  53. <div class="table">
  54. <a name="boost_typetraits.reference.add_rvalue_reference.examples"></a><p class="title"><b>Table&#160;1.15.&#160;Examples</b></p>
  55. <div class="table-contents"><table class="table" summary="Examples">
  56. <colgroup>
  57. <col>
  58. <col>
  59. </colgroup>
  60. <thead><tr>
  61. <th>
  62. <p>
  63. Expression
  64. </p>
  65. </th>
  66. <th>
  67. <p>
  68. Result Type
  69. </p>
  70. </th>
  71. </tr></thead>
  72. <tbody>
  73. <tr>
  74. <td>
  75. <p>
  76. <code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
  77. </p>
  78. </td>
  79. <td>
  80. <p>
  81. <code class="computeroutput"><span class="keyword">int</span><span class="special">&amp;&amp;</span></code>
  82. </p>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td>
  87. <p>
  88. <code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span>
  89. <span class="keyword">const</span><span class="special">&amp;&gt;::</span><span class="identifier">type</span></code>
  90. </p>
  91. </td>
  92. <td>
  93. <p>
  94. <code class="computeroutput"><span class="keyword">int</span> <span class="keyword">const</span><span class="special">&amp;</span></code>
  95. </p>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td>
  100. <p>
  101. <code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">*&gt;::</span><span class="identifier">type</span></code>
  102. </p>
  103. </td>
  104. <td>
  105. <p>
  106. <code class="computeroutput"><span class="keyword">int</span><span class="special">*&amp;&amp;</span></code>
  107. </p>
  108. </td>
  109. </tr>
  110. <tr>
  111. <td>
  112. <p>
  113. <code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">*&amp;&gt;::</span><span class="identifier">type</span></code>
  114. </p>
  115. </td>
  116. <td>
  117. <p>
  118. <code class="computeroutput"><span class="keyword">int</span><span class="special">*&amp;</span></code>
  119. </p>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td>
  124. <p>
  125. <code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&amp;&amp;&gt;::</span><span class="identifier">type</span></code>
  126. </p>
  127. </td>
  128. <td>
  129. <p>
  130. <code class="computeroutput"><span class="keyword">int</span><span class="special">&amp;&amp;</span></code>
  131. </p>
  132. </td>
  133. </tr>
  134. <tr>
  135. <td>
  136. <p>
  137. <code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
  138. </p>
  139. </td>
  140. <td>
  141. <p>
  142. <code class="computeroutput"><span class="keyword">void</span></code>
  143. </p>
  144. </td>
  145. </tr>
  146. </tbody>
  147. </table></div>
  148. </div>
  149. <br class="table-break"><p>
  150. <span class="bold"><strong>Compiler Compatibility:</strong></span> In the absence of
  151. rvalue-reference support this trait has no effect.
  152. </p>
  153. </div>
  154. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  155. <td align="left"></td>
  156. <td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2011 Adobe Systems Inc, David Abrahams,
  157. Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
  158. Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
  159. Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
  160. Watanabe<p>
  161. Distributed under the Boost Software License, Version 1.0. (See accompanying
  162. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  163. </p>
  164. </div></td>
  165. </tr></table>
  166. <hr>
  167. <div class="spirit-nav">
  168. <a accesskey="p" href="add_reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_volatile.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  169. </div>
  170. </body>
  171. </html>