forked from boostorg/type_traits
Add new traits add_lvalue_reference and add_rvalue_reference.
[SVN r65387]
This commit is contained in:
47
doc/add_lvalue_reference.qbk
Normal file
47
doc/add_lvalue_reference.qbk
Normal file
@ -0,0 +1,47 @@
|
||||
[/
|
||||
Copyright 2010 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_lvalue_reference add_lvalue_reference]
|
||||
|
||||
template <class T>
|
||||
struct add_lvalue_reference
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
__type If `T` names an object or function type then the member typedef `type`
|
||||
shall name `T&`; otherwise, if `T` names a type ['rvalue reference to U] then
|
||||
the member typedef type shall name `U&`; otherwise, type shall name `T`.
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_lvalue_reference<int>::type`][`int&`]]
|
||||
|
||||
[[`add_lvalue_reference<int const&>::type`] [`int const&`]]
|
||||
|
||||
[[`add_lvalue_reference<int*>::type`] [`int*&`]]
|
||||
|
||||
[[`add_lvalue_reference<int*&>::type`] [`int*&`]]
|
||||
|
||||
[[`add_lvalue_reference<int&&>::type`][`int&`]]
|
||||
|
||||
[[`add_lvalue_reference<void>::type`][`void`]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
@ -7,6 +7,12 @@
|
||||
|
||||
[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
|
||||
{
|
||||
|
50
doc/add_rvalue_reference.qbk
Normal file
50
doc/add_rvalue_reference.qbk
Normal file
@ -0,0 +1,50 @@
|
||||
[/
|
||||
Copyright 2010 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_rvalue_reference add_rvalue_reference]
|
||||
|
||||
template <class T>
|
||||
struct add_rvalue_reference
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
__type If `T` names an object or function type then the member typedef type
|
||||
shall name `T&&`; otherwise, type shall name `T`. ['\[Note: This rule reflects
|
||||
the semantics of reference collapsing. For example, when a type `T` names
|
||||
a type U&, the type `add_rvalue_reference<T>::type` is not an rvalue
|
||||
reference. -end note\]].
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
and rvalue references
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T`.
|
||||
|
||||
__header ` #include <boost/type_traits/add_rvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_rvalue_reference<int>::type`][`int&&`]]
|
||||
|
||||
[[`add_rvalue_reference<int const&>::type`] [`int const&`]]
|
||||
|
||||
[[`add_rvalue_reference<int*>::type`] [`int*&&`]]
|
||||
|
||||
[[`add_rvalue_reference<int*&>::type`] [`int*&`]]
|
||||
|
||||
[[`add_rvalue_reference<int&&>::type`][`int&&`]]
|
||||
|
||||
[[`add_rvalue_reference<void>::type`][`void`]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
@ -56,7 +56,7 @@
|
||||
method available to them.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.type_traits"></a><h5>
|
||||
<a name="id904364"></a>
|
||||
<a name="id1038712"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.type_traits">Type Traits</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -84,7 +84,7 @@
|
||||
given.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.implementation"></a><h5>
|
||||
<a name="id904427"></a>
|
||||
<a name="id1038776"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.implementation">Implementation</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -174,7 +174,7 @@
|
||||
in the default template.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.optimized_copy"></a><h5>
|
||||
<a name="id905164"></a>
|
||||
<a name="id1039513"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.optimized_copy">Optimized copy</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -247,7 +247,7 @@
|
||||
otherwise it will call the "slow but safe version".
|
||||
</p>
|
||||
<a name="boost_typetraits.background.was_it_worth_it_"></a><h5>
|
||||
<a name="id910514"></a>
|
||||
<a name="id1044863"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.was_it_worth_it_">Was it worth it?</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -280,7 +280,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<div class="table">
|
||||
<a name="id910559"></a><p class="title"><b>Table 1.1. Time taken to copy 1000 elements using `copy<const T*, T*>` (times
|
||||
<a name="id1044907"></a><p class="title"><b>Table 1.1. Time taken to copy 1000 elements using `copy<const T*, T*>` (times
|
||||
in micro-seconds)</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Time taken to copy 1000 elements using `copy<const T*, T*>` (times
|
||||
in micro-seconds)">
|
||||
@ -379,7 +379,7 @@
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break"><a name="boost_typetraits.background.pair_of_references"></a><h5>
|
||||
<a name="id910709"></a>
|
||||
<a name="id1045057"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.pair_of_references">Pair of References</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -416,7 +416,7 @@
|
||||
to hold non-reference types, references, and constant references:
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id910970"></a><p class="title"><b>Table 1.2. Required Constructor Argument Types</b></p>
|
||||
<a name="id1045319"></a><p class="title"><b>Table 1.2. Required Constructor Argument Types</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Required Constructor Argument Types">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -481,7 +481,7 @@
|
||||
adds a reference to its type, unless it is already a reference.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id911078"></a><p class="title"><b>Table 1.3. Using add_reference to synthesize the correct constructor type</b></p>
|
||||
<a name="id1045427"></a><p class="title"><b>Table 1.3. Using add_reference to synthesize the correct constructor type</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Using add_reference to synthesize the correct constructor type">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -597,7 +597,7 @@
|
||||
easier to maintain and easier to understand.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.conclusion"></a><h5>
|
||||
<a name="id911547"></a>
|
||||
<a name="id1045896"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.conclusion">Conclusion</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -610,7 +610,7 @@
|
||||
can be optimal as well as generic.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.acknowledgements"></a><h5>
|
||||
<a name="id911564"></a>
|
||||
<a name="id1045913"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.acknowledgements">Acknowledgements</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -618,7 +618,7 @@
|
||||
comments when preparing this article.
|
||||
</p>
|
||||
<a name="background.references"></a><a name="boost_typetraits.background.references"></a><h5>
|
||||
<a name="id911585"></a>
|
||||
<a name="id1045933"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.references">References</a>
|
||||
</h5>
|
||||
<div class="orderedlist"><ol type="1">
|
||||
|
@ -42,12 +42,18 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/add_cv.html" title="add_cv">add_cv</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/add_lvalue_reference.html" title="add_lvalue_reference">add_lvalue_reference</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/add_pointer.html" title="add_pointer">add_pointer</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/add_reference.html" title="add_reference">add_reference</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/add_rvalue_reference.html" title="add_rvalue_reference">add_rvalue_reference</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/add_volatile.html" title="add_volatile">add_volatile</a><span class="special">;</span>
|
||||
|
||||
@ -91,7 +97,7 @@
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/remove_volatile.html" title="remove_volatile">remove_volatile</a><span class="special">;</span>
|
||||
</pre>
|
||||
<a name="boost_typetraits.category.transform.broken_compiler_workarounds_"></a><h5>
|
||||
<a name="id915484"></a>
|
||||
<a name="id1049903"></a>
|
||||
<a class="link" href="transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">Broken
|
||||
Compiler Workarounds:</a>
|
||||
</h5>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a name="boost_typetraits.history"></a><a class="link" href="history.html" title="History"> History</a>
|
||||
</h2></div></div></div>
|
||||
<a name="boost_typetraits.history.boost_1_44_0"></a><h5>
|
||||
<a name="id965403"></a>
|
||||
<a name="id1101861"></a>
|
||||
<a class="link" href="history.html#boost_typetraits.history.boost_1_44_0">Boost 1.44.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
@ -43,7 +43,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_typetraits.history.boost_1_42_0"></a><h5>
|
||||
<a name="id965458"></a>
|
||||
<a name="id1101916"></a>
|
||||
<a class="link" href="history.html#boost_typetraits.history.boost_1_42_0">Boost 1.42.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc"><li>
|
||||
|
@ -99,7 +99,7 @@
|
||||
of the following macros:
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id917632"></a><p class="title"><b>Table 1.4. Macros for Compiler Intrinsics</b></p>
|
||||
<a name="id1052050"></a><p class="title"><b>Table 1.4. Macros for Compiler Intrinsics</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Macros for Compiler Intrinsics">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -29,8 +29,10 @@
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="reference/add_const.html"> add_const</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_cv.html"> add_cv</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_lvalue_reference.html"> add_lvalue_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_pointer.html"> add_pointer</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_reference.html"> add_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_rvalue_reference.html"> add_rvalue_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_volatile.html"> add_volatile</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/aligned_storage.html"> aligned_storage</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/alignment_of.html"> alignment_of</a></span></dt>
|
||||
|
@ -53,7 +53,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id923691"></a><p class="title"><b>Table 1.5. Examples</b></p>
|
||||
<a name="id1058110"></a><p class="title"><b>Table 1.5. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_const.html" title="add_const">
|
||||
<link rel="next" href="add_pointer.html" title="add_pointer">
|
||||
<link rel="next" href="add_lvalue_reference.html" title="add_lvalue_reference">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_const.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_pointer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="add_const.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_lvalue_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@ -54,7 +54,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id924169"></a><p class="title"><b>Table 1.6. Examples</b></p>
|
||||
<a name="id1058587"></a><p class="title"><b>Table 1.6. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -142,7 +142,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_const.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_pointer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="add_const.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_lvalue_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_cv.html" title="add_cv">
|
||||
<link rel="prev" href="add_lvalue_reference.html" title="add_lvalue_reference">
|
||||
<link rel="next" href="add_reference.html" title="add_reference">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_cv.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_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="add_lvalue_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_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@ -56,7 +56,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id924698"></a><p class="title"><b>Table 1.7. Examples</b></p>
|
||||
<a name="id1059719"></a><p class="title"><b>Table 1.8. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -141,7 +141,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_cv.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_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="add_lvalue_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_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_pointer.html" title="add_pointer">
|
||||
<link rel="next" href="add_volatile.html" title="add_volatile">
|
||||
<link rel="next" href="add_rvalue_reference.html" title="add_rvalue_reference">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@ -20,12 +20,24 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_pointer.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>
|
||||
<a accesskey="p" href="add_pointer.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_rvalue_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.reference.add_reference"></a><a class="link" href="add_reference.html" title="add_reference"> add_reference</a>
|
||||
</h3></div></div></div>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
This trait has been made obsolete by <a class="link" href="add_lvalue_reference.html" title="add_lvalue_reference">add_lvalue_reference</a>
|
||||
and <a class="link" href="add_rvalue_reference.html" title="add_rvalue_reference">add_rvalue_reference</a>,
|
||||
and new code should use these new traits rather than <a class="link" href="is_reference.html" title="is_reference">is_reference</a>
|
||||
which is retained for backwards compatibility only.
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">add_reference</span>
|
||||
<span class="special">{</span>
|
||||
@ -53,7 +65,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id925175"></a><p class="title"><b>Table 1.8. Examples</b></p>
|
||||
<a name="id1060217"></a><p class="title"><b>Table 1.9. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -138,7 +150,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_pointer.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>
|
||||
<a accesskey="p" href="add_pointer.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_rvalue_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_reference.html" title="add_reference">
|
||||
<link rel="prev" href="add_rvalue_reference.html" title="add_rvalue_reference">
|
||||
<link rel="next" href="aligned_storage.html" title="aligned_storage">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<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="aligned_storage.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="add_rvalue_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="aligned_storage.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@ -53,7 +53,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id925645"></a><p class="title"><b>Table 1.9. Examples</b></p>
|
||||
<a name="id1061289"></a><p class="title"><b>Table 1.11. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -140,7 +140,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<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="aligned_storage.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="add_rvalue_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="aligned_storage.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -48,7 +48,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id926890"></a><p class="title"><b>Table 1.10. Examples</b></p>
|
||||
<a name="id1064172"></a><p class="title"><b>Table 1.12. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -49,7 +49,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id930080"></a><p class="title"><b>Table 1.11. Examples</b></p>
|
||||
<a name="id1065724"></a><p class="title"><b>Table 1.13. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -59,7 +59,7 @@
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<div class="table">
|
||||
<a name="id930453"></a><p class="title"><b>Table 1.12. Function Traits Members</b></p>
|
||||
<a name="id1066098"></a><p class="title"><b>Table 1.14. Function Traits Members</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Function Traits Members">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -122,7 +122,7 @@
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break"><div class="table">
|
||||
<a name="id930671"></a><p class="title"><b>Table 1.13. Examples</b></p>
|
||||
<a name="id1066315"></a><p class="title"><b>Table 1.15. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -49,7 +49,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id936317"></a><p class="title"><b>Table 1.14. Examples</b></p>
|
||||
<a name="id1071961"></a><p class="title"><b>Table 1.16. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -54,7 +54,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id956877"></a><p class="title"><b>Table 1.15. Examples</b></p>
|
||||
<a name="id1093886"></a><p class="title"><b>Table 1.17. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -54,7 +54,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id957359"></a><p class="title"><b>Table 1.16. Examples</b></p>
|
||||
<a name="id1094368"></a><p class="title"><b>Table 1.18. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -51,7 +51,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id958981"></a><p class="title"><b>Table 1.17. Examples</b></p>
|
||||
<a name="id1094893"></a><p class="title"><b>Table 1.19. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -54,7 +54,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id960078"></a><p class="title"><b>Table 1.18. Examples</b></p>
|
||||
<a name="id1097629"></a><p class="title"><b>Table 1.20. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -53,7 +53,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id960622"></a><p class="title"><b>Table 1.19. Examples</b></p>
|
||||
<a name="id1098172"></a><p class="title"><b>Table 1.21. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -53,7 +53,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id962791"></a><p class="title"><b>Table 1.20. Examples</b></p>
|
||||
<a name="id1098703"></a><p class="title"><b>Table 1.22. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -54,7 +54,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id963320"></a><p class="title"><b>Table 1.21. Examples</b></p>
|
||||
<a name="id1099232"></a><p class="title"><b>Table 1.23. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -55,7 +55,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id963874"></a><p class="title"><b>Table 1.22. Examples</b></p>
|
||||
<a name="id1099787"></a><p class="title"><b>Table 1.24. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -53,7 +53,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id964387"></a><p class="title"><b>Table 1.23. Examples</b></p>
|
||||
<a name="id1100299"></a><p class="title"><b>Table 1.25. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -53,7 +53,7 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id964889"></a><p class="title"><b>Table 1.24. Examples</b></p>
|
||||
<a name="id1100801"></a><p class="title"><b>Table 1.26. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -30,7 +30,7 @@
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id904215"></a><p>
|
||||
<a name="id1038564"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
@ -80,8 +80,10 @@
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/add_const.html"> add_const</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/add_cv.html"> add_cv</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/add_lvalue_reference.html"> add_lvalue_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/add_pointer.html"> add_pointer</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/add_reference.html"> add_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/add_rvalue_reference.html"> add_rvalue_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/add_volatile.html"> add_volatile</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/aligned_storage.html"> aligned_storage</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/alignment_of.html"> alignment_of</a></span></dt>
|
||||
|
@ -19,6 +19,9 @@ result of applying the transformation to the template argument `T`.
|
||||
|
||||
template <class T>
|
||||
struct __add_cv;
|
||||
|
||||
template <class T>
|
||||
struct __add_lvalue_reference;
|
||||
|
||||
template <class T>
|
||||
struct __add_pointer;
|
||||
@ -26,6 +29,9 @@ result of applying the transformation to the template argument `T`.
|
||||
template <class T>
|
||||
struct __add_reference;
|
||||
|
||||
template <class T>
|
||||
struct __add_rvalue_reference;
|
||||
|
||||
template <class T>
|
||||
struct __add_volatile;
|
||||
|
||||
|
@ -101,6 +101,8 @@
|
||||
[def __remove_all_extents [link boost_typetraits.reference.remove_all_extents remove_all_extents]]
|
||||
[def __remove_pointer [link boost_typetraits.reference.remove_pointer remove_pointer]]
|
||||
[def __add_reference [link boost_typetraits.reference.add_reference add_reference]]
|
||||
[def __add_lvalue_reference [link boost_typetraits.reference.add_lvalue_reference add_lvalue_reference]]
|
||||
[def __add_rvalue_reference [link boost_typetraits.reference.add_rvalue_reference add_rvalue_reference]]
|
||||
[def __add_pointer [link boost_typetraits.reference.add_pointer add_pointer]]
|
||||
[def __add_const [link boost_typetraits.reference.add_const add_const]]
|
||||
[def __add_volatile [link boost_typetraits.reference.add_volatile add_volatile]]
|
||||
@ -162,8 +164,10 @@ that is the result of the transformation.
|
||||
|
||||
[include add_const.qbk]
|
||||
[include add_cv.qbk]
|
||||
[include add_lvalue_reference.qbk]
|
||||
[include add_pointer.qbk]
|
||||
[include add_reference.qbk]
|
||||
[include add_rvalue_reference.qbk]
|
||||
[include add_volatile.qbk]
|
||||
[include aligned_storage.qbk]
|
||||
[include alignment_of.qbk]
|
||||
|
26
include/boost/type_traits/add_lvalue_reference.hpp
Normal file
26
include/boost/type_traits/add_lvalue_reference.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2010 John Maddock
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP
|
||||
#define BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
// should be the last #include
|
||||
#include <boost/type_traits/detail/type_trait_def.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_lvalue_reference,T,typename boost::add_reference<T>::type)
|
||||
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_lvalue_reference,T&&,T&)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#include <boost/type_traits/detail/type_trait_undef.hpp>
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP
|
67
include/boost/type_traits/add_rvalue_reference.hpp
Normal file
67
include/boost/type_traits/add_rvalue_reference.hpp
Normal file
@ -0,0 +1,67 @@
|
||||
// add_rvalue_reference.hpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
|
||||
#define BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
|
||||
// should be the last #include
|
||||
#include <boost/type_traits/detail/type_trait_def.hpp>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// C++03 implementation of //
|
||||
// 20.7.6.2 Reference modifications [meta.trans.ref] //
|
||||
// Written by Vicente J. Botet Escriba //
|
||||
// //
|
||||
// If T names an object or function type then the member typedef type
|
||||
// shall name T&&; otherwise, type shall name T. [ Note: This rule reflects
|
||||
// the semantics of reference collapsing. For example, when a type T names
|
||||
// a type T1&, the type add_rvalue_reference<T>::type is not an rvalue
|
||||
// reference. <20>end note ]
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace type_traits_detail {
|
||||
|
||||
template <typename T, bool b>
|
||||
struct add_rvalue_reference_helper
|
||||
{ typedef T type; };
|
||||
|
||||
template <typename T>
|
||||
struct add_rvalue_reference_helper<T, true>
|
||||
{
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
typedef T&& type;
|
||||
#else
|
||||
typedef T type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct add_rvalue_reference_imp
|
||||
{
|
||||
typedef typename boost::type_traits_detail::add_rvalue_reference_helper
|
||||
<T, (!is_void<T>::value && !is_reference<T>::value) >::type type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost::type_traits_detail::add_rvalue_reference_imp<T>::type)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/type_traits/detail/type_trait_undef.hpp>
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
|
63
test/add_lvalue_reference_test.cpp
Normal file
63
test/add_lvalue_reference_test.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.tt.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/add_lvalue_reference.hpp>
|
||||
#endif
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_1, ::tt::add_lvalue_reference, const, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_2, ::tt::add_lvalue_reference, volatile, volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_3, ::tt::add_lvalue_reference, *, *&)
|
||||
BOOST_DECL_TRANSFORM_TEST2(add_lvalue_reference_test_4, ::tt::add_lvalue_reference, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_5, ::tt::add_lvalue_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_6, ::tt::add_lvalue_reference, &, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_7, ::tt::add_lvalue_reference, *volatile, *volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_8, ::tt::add_lvalue_reference, const [2], const (&)[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_9, ::tt::add_lvalue_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_10, ::tt::add_lvalue_reference, const*, const*&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_11, ::tt::add_lvalue_reference, volatile*, volatile*&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_12, ::tt::add_lvalue_reference, const[2][3], const (&)[2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_13, ::tt::add_lvalue_reference, (&)[2], (&)[2])
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_5a, ::tt::add_lvalue_reference, const &&, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_6a, ::tt::add_lvalue_reference, &&, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_13a, ::tt::add_lvalue_reference, (&&)[2], (&)[2])
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(add_lvalue_reference)
|
||||
|
||||
add_lvalue_reference_test_1();
|
||||
add_lvalue_reference_test_2();
|
||||
add_lvalue_reference_test_3();
|
||||
add_lvalue_reference_test_4();
|
||||
add_lvalue_reference_test_5();
|
||||
add_lvalue_reference_test_6();
|
||||
add_lvalue_reference_test_7();
|
||||
add_lvalue_reference_test_8();
|
||||
add_lvalue_reference_test_9();
|
||||
add_lvalue_reference_test_10();
|
||||
add_lvalue_reference_test_11();
|
||||
add_lvalue_reference_test_12();
|
||||
add_lvalue_reference_test_13();
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
add_lvalue_reference_test_5a();
|
||||
add_lvalue_reference_test_6a();
|
||||
add_lvalue_reference_test_13a();
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
80
test/add_rvalue_reference_test.cpp
Normal file
80
test/add_rvalue_reference_test.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.tt.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "../../type_traits/test/test.hpp"
|
||||
#include "../../type_traits/test/check_type.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/add_rvalue_reference.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_RVALUE_REFERENCES
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_1, ::tt::add_rvalue_reference, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_2, ::tt::add_rvalue_reference, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_3, ::tt::add_rvalue_reference, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST0(add_rvalue_reference_test_4, ::tt::add_rvalue_reference)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_5, ::tt::add_rvalue_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_6, ::tt::add_rvalue_reference, &, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_7, ::tt::add_rvalue_reference, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_8, ::tt::add_rvalue_reference, const [2], const [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_9, ::tt::add_rvalue_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_10, ::tt::add_rvalue_reference, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_11, ::tt::add_rvalue_reference, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_12, ::tt::add_rvalue_reference, const[2][3], const [2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_13, ::tt::add_rvalue_reference, (&)[2], (&)[2])
|
||||
#else
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_1, ::tt::add_rvalue_reference, const, const&&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_2, ::tt::add_rvalue_reference, volatile, volatile&&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_3, ::tt::add_rvalue_reference, *, *&&)
|
||||
BOOST_DECL_TRANSFORM_TEST2(add_rvalue_reference_test_4, ::tt::add_rvalue_reference, &&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_5, ::tt::add_rvalue_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_6, ::tt::add_rvalue_reference, &, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_7, ::tt::add_rvalue_reference, *volatile, *volatile&&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_8, ::tt::add_rvalue_reference, const [2], const (&&) [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_9, ::tt::add_rvalue_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_10, ::tt::add_rvalue_reference, const*, const*&&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_11, ::tt::add_rvalue_reference, volatile*, volatile*&&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_12, ::tt::add_rvalue_reference, const[2][3], const (&&) [2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_13, ::tt::add_rvalue_reference, (&)[2], (&)[2])
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_5a, ::tt::add_rvalue_reference, const &&, const&&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_6a, ::tt::add_rvalue_reference, &&, &&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_13a, ::tt::add_rvalue_reference, (&&)[2], (&&)[2])
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(add_rvalue_reference)
|
||||
|
||||
add_rvalue_reference_test_1();
|
||||
add_rvalue_reference_test_2();
|
||||
add_rvalue_reference_test_3();
|
||||
add_rvalue_reference_test_4();
|
||||
add_rvalue_reference_test_5();
|
||||
add_rvalue_reference_test_6();
|
||||
add_rvalue_reference_test_7();
|
||||
add_rvalue_reference_test_8();
|
||||
add_rvalue_reference_test_9();
|
||||
add_rvalue_reference_test_10();
|
||||
add_rvalue_reference_test_11();
|
||||
add_rvalue_reference_test_12();
|
||||
add_rvalue_reference_test_13();
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
add_rvalue_reference_test_5a();
|
||||
add_rvalue_reference_test_6a();
|
||||
add_rvalue_reference_test_13a();
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user