Add declval and common type from Vicente J. Botet Escriba.

Regenerate docs.

[SVN r65443]
This commit is contained in:
John Maddock committed 2010-09-17 12:12:03 +00:00
1 parent e66ffd9a99
commit afd6785017
43 files changed
+1779 -50

No files matched your search

+219
View File
@@ -0,0 +1,219 @@
[/===================================================================]
[section:common_type common_type]
[/===================================================================]
[def __declval [@../../../utility/doc/html/declval.html declval]]
`#include <boost/type_traits/common_type.hpp>`
namespace boost {
template <class ...T> struct __common_type;
}
__common_type is a traits class used to deduce a type common to a several types, useful as the return type of functions
operating on multiple input types such as in mixed-mode arithmetic..
The nested typedef `::type` could be defined as follows:
template <class ...T>
struct common_type;
template <class T, class U, class ...V>
struct common_type<T,U,...V> {
typedef typename __common_type<typename __common_type<T, U>::type, V...>::type type;
};
template <class T>
struct common_type<T> {
typedef T type;
};
template <class T, class U>
struct common_type<T, U> {
typedef decltype(__declval<bool>() ? __declval<T>() : __declval<U>()) type;
};
All parameter types must be complete. This trait is permitted to be specialized by a user if at least one
template parameter is a user-defined type. [*Note:] Such specializations are required when only explicit conversions
are desired among the __common_type arguments.
Note that when the compiler does not support variadic templates (and the macro BOOST_NO_VARIADIC_TEMPLATES is defined)
then the maximum number of template arguments is 3.
[h4 Configuration macros]
When the compiler does not support static assertions then the user can select the way static assertions are reported. Define
* BOOST_COMMON_TYPE_USES_STATIC_ASSERT: define it if you want to use Boost.StaticAssert
* BOOST_COMMON_TYPE_USES_MPL_ASSERT: define it if you want to use Boost.MPL static asertions
The default behavior is to use mpl assertions in this case, but setting BOOST_COMMON_TYPE_USES_STATIC_ASSERT may reduce
compile times and header dependencies somewhat.
Depending on the static assertion used you will have an hint of the failing assertion either through the symbol or through the text.
When possible common_type is implemented using `decltype`. Otherwise when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is not defined
it uses Boost.TypeOf.
[h4 Tutorial]
In a nutshell, __common_type is a trait that takes 1 or more types, and returns a type which
all of the types will convert to. The default definition demands this conversion be implicit.
However the trait can be specialized for user-defined types which want to limit their inter-type conversions to explicit,
and yet still want to interoperate with the __common_type facility.
[*Example:]
template <class T, class U>
complex<typename __common_type<T, U>::type>
operator+(complex<T>, complex<U>);
In the above example, "mixed-mode" complex arithmetic is allowed. The return type is described by __common_type.
For example the resulting type of adding a `complex<float>` and `complex<double>` might be a `complex<double>`.
Here is how someone might produce a variadic comparison function:
template <class ...T>
typename __common_type<T...>::type
min(T... t);
This is a very useful and broadly applicable utility.
[h4 How to get the common type of types with explicit conversions?]
Another choice for the author of the preceding operator could be
template <class T, class U>
typename __common_type<complex<T>, complex<U> >::type
operator+(complex<T>, complex<U>);
As the default definition of __common_type demands the conversion be implicit, we need to specialize the trait for complex types as follows.
template <class T, class U>
struct __common_type<complex<T>, complex<U> > {
typedef complex< __common_type<T, U> > type;
};
[h4 How important is the order of the common_type<> template arguments?]
The order of the template parameters is important.
`common_type<A,B,C>::type` is not equivalent to `common_type<C,A,B>::type`, but to `common_type<common_type<A,B>::type, C>::type`.
Consider
struct A {};
struct B {};
struct C {
C() {}
C(A const&) {}
C(B const&) {}
C& operator=(C const&) {
return *this;
}
};
The following doesn't compile
typedef boost::common_type<A, B, C>::type ABC; // Does not compile
while
typedef boost::common_type<C, A, B>::type ABC;
compiles.
Thus, as `common_type<A,B>::type` is undefined, `common_type<A,B,C>::type` is also undefined.
It is intended that clients who wish for `common_type<A, B>` to be well
defined to define it themselves:
namespace boost
{
template <>
struct common_type<A, B> {typedef C type;};
}
Now this client can ask for `common_type<A, B, C>` (and get
the same answer).
Clients wanting to ask `common_type<A, B, C>` in any order and get the same result need to add in addition:
namespace boost
{
template <> struct common_type<B, A>
: public common_type<A, B> {};
}
This is needed as the specialization of `common_type<A, B>` is not be used implicitly for `common_type<B, A>`.
[h4 Can the common_type of two types be a third type?]
Given the preceding example, one might expect `common_type<A,B>::type` to be `C` without any intervention from the user.
But the default `common_type<>` implementation doesn't grant that. It is intended that clients who wish for `common_type<A, B>`
to be well defined to define it themselves:
namespace boost
{
template <>
struct common_type<A, B> {typedef C type;};
template <> struct common_type<B, A>
: public common_type<A, B> {};
}
Now this client can ask for `common_type<A, B>`.
[h4 How common_type behaves with pointers?]
Consider
struct C { }:
struct B : C { };
struct A : C { };
Shouldn't `common_type<A*,B*>::type` be `C*`? I would say yes, but the default implementation will make it ill-formed.
The library could add a specialization for pointers, as
namespace boost
{
template <typename A, typename B>
struct common_type<A*, B*> {
typedef common_type<A, B>* type;
};
}
But in the absence of a motivating use cases, we prefer not to add more than the standard specifies.
Of course the user can always make this specialization.
[h4 Can you explain the pros/cons of common_type against Boost.Typeof?]
Even if they appear to be close, `__common_type` and `typeof` have
different purposes. You use `typeof` to get the type of an expression, while
you use __common_type to set explicitly the type returned of a template
function. Both are complementary, and indeed __common_type is equivalent to
`decltype(__declval<bool>() ? __declval<T>() : __declval<U>())`
__common_type is also similar to promote_args<class ...T> in boost/math/tools/promotion.hpp,
though it is not exactly the same as promote_args either. __common_type<T1, T2>::type simply represents the result of some
operation on T1 and T2, and defaults to the type obtained by putting T1 and T2 into a conditional statement.
It is meant to be customizable (via specialization) if this default is not appropriate.
[endsect]
+17
View File
@@ -216,5 +216,22 @@ and enum types to double:
[endsect]
[section:improved_min Improving std::min with common_type]
An improved `std::min` function could be written like this:
template <class T, class U>
typename __common_type<T, U>::type min(T t, T u)
{
return t < u ? t : u;
}
And now expressions such as:
min(1, 2.0)
will actually compile and return the correct type!
[endsect]
[endsect]
+11 -11
View File
@@ -56,7 +56,7 @@
method available to them.
</p>
<a name="boost_typetraits.background.type_traits"></a><h5>
<a name="id1038712"></a>
<a name="id902179"></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="id1038776"></a>
<a name="id902243"></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="id1039513"></a>
<a name="id902979"></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="id1044863"></a>
<a name="id908330"></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="id1044907"></a><p class="title"><b>Table&#160;1.1.&#160;Time taken to copy 1000 elements using `copy&lt;const T*, T*&gt;` (times
<a name="id908374"></a><p class="title"><b>Table&#160;1.1.&#160;Time taken to copy 1000 elements using `copy&lt;const T*, T*&gt;` (times
in micro-seconds)</b></p>
<div class="table-contents"><table class="table" summary="Time taken to copy 1000 elements using `copy&lt;const T*, T*&gt;` (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="id1045057"></a>
<a name="id908524"></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="id1045319"></a><p class="title"><b>Table&#160;1.2.&#160;Required Constructor Argument Types</b></p>
<a name="id908786"></a><p class="title"><b>Table&#160;1.2.&#160;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="id1045427"></a><p class="title"><b>Table&#160;1.3.&#160;Using add_reference to synthesize the correct constructor type</b></p>
<a name="id908894"></a><p class="title"><b>Table&#160;1.3.&#160;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="id1045896"></a>
<a name="id909363"></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="id1045913"></a>
<a name="id909380"></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="id1045933"></a>
<a name="id909400"></a>
<a class="link" href="background.html#boost_typetraits.background.references">References</a>
</h5>
<div class="orderedlist"><ol type="1">
@@ -57,6 +57,9 @@
<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">struct</span> <a class="link" href="../reference/add_volatile.html" title="add_volatile">add_volatile</a><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../reference/common_type.html" title="common_type">common_type</a><span class="special">;</span>
<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">struct</span> <a class="link" href="../reference/decay.html" title="decay">decay</a><span class="special">;</span>
@@ -97,7 +100,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="id1049903"></a>
<a name="id913408"></a>
<a class="link" href="transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">Broken
Compiler Workarounds:</a>
</h5>
+2
View File
@@ -37,6 +37,8 @@
of std::iter_swap</a></span></dt>
<dt><span class="section"><a href="examples/to_double.html"> Convert Numeric
Types and Enums to double</a></span></dt>
<dt><span class="section"><a href="examples/improved_min.html"> Improving std::min
with common_type</a></span></dt>
</dl></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
@@ -0,0 +1,64 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Improving std::min with common_type</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="to_double.html" title="Convert Numeric Types and Enums to double">
<link rel="next" href="../reference.html" title="Alphabetical Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="to_double.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.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="../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.examples.improved_min"></a><a class="link" href="improved_min.html" title="Improving std::min with common_type"> Improving std::min
with common_type</a>
</h3></div></div></div>
<p>
An improved <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">min</span></code> function could be written like this:
</p>
<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">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
<span class="keyword">typename</span> <a class="link" href="../reference/common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">min</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">u</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">t</span> <span class="special">&lt;</span> <span class="identifier">u</span> <span class="special">?</span> <span class="identifier">t</span> <span class="special">:</span> <span class="identifier">u</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
And now expressions such as:
</p>
<pre class="programlisting"><span class="identifier">min</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2.0</span><span class="special">)</span>
</pre>
<p>
will actually compile and return the correct type!
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2006 Adobe Systems Inc, David Abrahams,
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
Ramey and Jeremy Siek<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>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="to_double.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.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="../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&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="iter.html" title="An improved Version of std::iter_swap">
<link rel="next" href="../reference.html" title="Alphabetical Reference">
<link rel="next" href="improved_min.html" title="Improving std::min with common_type">
</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="iter.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.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="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="iter.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.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="improved_min.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">
@@ -52,7 +52,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="iter.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.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="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="iter.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.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="improved_min.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
+2 -2
View File
@@ -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="id1101861"></a>
<a name="id969631"></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="id1101916"></a>
<a name="id969687"></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>
+1 -1
View File
@@ -99,7 +99,7 @@
of the following macros:
</p>
<div class="table">
<a name="id1052050"></a><p class="title"><b>Table&#160;1.4.&#160;Macros for Compiler Intrinsics</b></p>
<a name="id915555"></a><p class="title"><b>Table&#160;1.4.&#160;Macros for Compiler Intrinsics</b></p>
<div class="table-contents"><table class="table" summary="Macros for Compiler Intrinsics">
<colgroup>
<col>
+6 -3
View File
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
<link rel="prev" href="examples/to_double.html" title="Convert Numeric Types and Enums to double">
<link rel="prev" href="examples/improved_min.html" title="Improving std::min with common_type">
<link rel="next" href="reference/add_const.html" title="add_const">
</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="examples/to_double.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="reference/add_const.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="examples/improved_min.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="reference/add_const.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -36,6 +36,7 @@
<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>
<dt><span class="section"><a href="reference/common_type.html"> common_type</a></span></dt>
<dt><span class="section"><a href="reference/decay.html"> decay</a></span></dt>
<dt><span class="section"><a href="reference/extent.html"> extent</a></span></dt>
<dt><span class="section"><a href="reference/floating_point_promotion.html">
@@ -107,6 +108,8 @@
<dt><span class="section"><a href="reference/remove_volatile.html"> remove_volatile</a></span></dt>
<dt><span class="section"><a href="reference/type_with_alignment.html"> type_with_alignment</a></span></dt>
</dl></div>
<p>
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
@@ -121,7 +124,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="examples/to_double.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="reference/add_const.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="examples/improved_min.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="reference/add_const.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
@@ -53,7 +53,7 @@
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>
</p>
<div class="table">
<a name="id1058110"></a><p class="title"><b>Table&#160;1.5.&#160;Examples</b></p>
<a name="id921834"></a><p class="title"><b>Table&#160;1.5.&#160;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">&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>
</p>
<div class="table">
<a name="id1058587"></a><p class="title"><b>Table&#160;1.6.&#160;Examples</b></p>
<a name="id922312"></a><p class="title"><b>Table&#160;1.6.&#160;Examples</b></p>
<div class="table-contents"><table class="table" summary="Examples">
<colgroup>
<col>
@@ -0,0 +1,174 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>add_lvalue_reference</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../reference.html" title="Alphabetical Reference">
<link rel="prev" href="add_cv.html" title="add_cv">
<link rel="next" href="add_pointer.html" title="add_pointer">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</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_pointer.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_lvalue_reference"></a><a class="link" href="add_lvalue_reference.html" title="add_lvalue_reference"> add_lvalue_reference</a>
</h3></div></div></div>
<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>
<span class="keyword">struct</span> <span class="identifier">add_lvalue_reference</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <em class="replaceable"><code>see-below</code></em> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
<span class="bold"><strong>type:</strong></span> If <code class="computeroutput"><span class="identifier">T</span></code>
names an object or function type then the member typedef <code class="computeroutput"><span class="identifier">type</span></code>
shall name <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span></code>;
otherwise, if <code class="computeroutput"><span class="identifier">T</span></code> names a type
<span class="emphasis"><em>rvalue reference to U</em></span> then the member typedef type shall
name <code class="computeroutput"><span class="identifier">U</span><span class="special">&amp;</span></code>;
otherwise, type shall name <code class="computeroutput"><span class="identifier">T</span></code>.
</p>
<p>
<span class="bold"><strong>C++ Standard Reference:</strong></span> 20.7.6.2.
</p>
<p>
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
does not support partial specialization of class-templates then this template
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
workarounds</a> have been applied.
</p>
<p>
<span class="bold"><strong>Header:</strong></span> <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">add_lvalue_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
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>
</p>
<div class="table">
<a name="id922834"></a><p class="title"><b>Table&#160;1.7.&#160;Examples</b></p>
<div class="table-contents"><table class="table" summary="Examples">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Result Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">add_lvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">add_lvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span>
<span class="keyword">const</span><span class="special">&amp;&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span> <span class="keyword">const</span><span class="special">&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">add_lvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">*&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">*&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">add_lvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">*&amp;&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">*&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">add_lvalue_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>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">add_lvalue_reference</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">void</span></code>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2006 Adobe Systems Inc, David Abrahams,
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
Ramey and Jeremy Siek<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>
</div></td>
</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_pointer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
@@ -56,7 +56,7 @@
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>
</p>
<div class="table">
<a name="id1059719"></a><p class="title"><b>Table&#160;1.8.&#160;Examples</b></p>
<a name="id923444"></a><p class="title"><b>Table&#160;1.8.&#160;Examples</b></p>
<div class="table-contents"><table class="table" summary="Examples">
<colgroup>
<col>
@@ -65,7 +65,7 @@
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>
</p>
<div class="table">
<a name="id1060217"></a><p class="title"><b>Table&#160;1.9.&#160;Examples</b></p>
<a name="id923942"></a><p class="title"><b>Table&#160;1.9.&#160;Examples</b></p>
<div class="table-contents"><table class="table" summary="Examples">
<colgroup>
<col>
@@ -0,0 +1,172 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>add_rvalue_reference</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../reference.html" title="Alphabetical Reference">
<link rel="prev" href="add_reference.html" title="add_reference">
<link rel="next" href="add_volatile.html" title="add_volatile">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</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="add_volatile.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_rvalue_reference"></a><a class="link" href="add_rvalue_reference.html" title="add_rvalue_reference"> add_rvalue_reference</a>
</h3></div></div></div>
<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>
<span class="keyword">struct</span> <span class="identifier">add_rvalue_reference</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <em class="replaceable"><code>see-below</code></em> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
<span class="bold"><strong>type:</strong></span> If <code class="computeroutput"><span class="identifier">T</span></code>
names an object or function type then the member typedef type shall name
<code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;&amp;</span></code>;
otherwise, type shall name <code class="computeroutput"><span class="identifier">T</span></code>.
<span class="emphasis"><em>[Note: This rule reflects the semantics of reference collapsing.
For example, when a type <code class="computeroutput"><span class="identifier">T</span></code>
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>.
</p>
<p>
<span class="bold"><strong>C++ Standard Reference:</strong></span> 20.7.6.2.
</p>
<p>
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
does not support partial specialization of class-templates and rvalue references
then this template will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>.
</p>
<p>
<span class="bold"><strong>Header:</strong></span> <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">add_rvalue_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
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>
</p>
<div class="table">
<a name="id924446"></a><p class="title"><b>Table&#160;1.10.&#160;Examples</b></p>
<div class="table-contents"><table class="table" summary="Examples">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Result Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<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>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">&amp;&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="keyword">int</span>
<span class="keyword">const</span><span class="special">&amp;&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span> <span class="keyword">const</span><span class="special">&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<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>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">*&amp;&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<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>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">*&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<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>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span><span class="special">&amp;&amp;</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<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>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">void</span></code>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2006 Adobe Systems Inc, David Abrahams,
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
Ramey and Jeremy Siek<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>
</div></td>
</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="add_volatile.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
@@ -53,7 +53,7 @@
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>
</p>
<div class="table">
<a name="id1061289"></a><p class="title"><b>Table&#160;1.11.&#160;Examples</b></p>
<a name="id925014"></a><p class="title"><b>Table&#160;1.11.&#160;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&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../reference.html" title="Alphabetical Reference">
<link rel="prev" href="aligned_storage.html" title="aligned_storage">
<link rel="next" href="decay.html" title="decay">
<link rel="next" href="common_type.html" title="common_type">
</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="aligned_storage.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="decay.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="aligned_storage.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="common_type.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">
@@ -76,7 +76,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="aligned_storage.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="decay.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="aligned_storage.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="common_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
@@ -0,0 +1,350 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>common_type</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../reference.html" title="Alphabetical Reference">
<link rel="prev" href="alignment_of.html" title="alignment_of">
<link rel="next" href="decay.html" title="decay">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="alignment_of.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="decay.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.common_type"></a><a class="link" href="common_type.html" title="common_type"> common_type</a>
</h3></div></div></div>
<p>
<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">common_type</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
<a class="link" href="common_type.html" title="common_type">common_type</a>
is a traits class used to deduce a type common to a several types, useful
as the return type of functions operating on multiple input types such as
in mixed-mode arithmetic..
</p>
<p>
The nested typedef <code class="computeroutput"><span class="special">::</span><span class="identifier">type</span></code>
could be defined as follows:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">,</span> <span class="keyword">class</span> <span class="special">...</span><span class="identifier">V</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">U</span><span class="special">,...</span><span class="identifier">V</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">V</span><span class="special">...&gt;::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<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">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">T</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">decltype</span><span class="special">(</span><a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">&gt;()</span> <span class="special">?</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;()</span> <span class="special">:</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;())</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
All parameter types must be complete. This trait is permitted to be specialized
by a user if at least one template parameter is a user-defined type. <span class="bold"><strong>Note:</strong></span> Such specializations are required when only
explicit conversions are desired among the <a class="link" href="common_type.html" title="common_type">common_type</a>
arguments.
</p>
<p>
Note that when the compiler does not support variadic templates (and the
macro BOOST_NO_VARIADIC_TEMPLATES is defined) then the maximum number of
template arguments is 3.
</p>
<a name="boost_typetraits.reference.common_type.configuration_macros"></a><h5>
<a name="id928233"></a>
<a class="link" href="common_type.html#boost_typetraits.reference.common_type.configuration_macros">Configuration
macros</a>
</h5>
<p>
When the compiler does not support static assertions then the user can select
the way static assertions are reported. Define
</p>
<div class="itemizedlist"><ul type="disc">
<li>
BOOST_COMMON_TYPE_USES_STATIC_ASSERT: define it if you want to use Boost.StaticAssert
</li>
<li>
BOOST_COMMON_TYPE_USES_MPL_ASSERT: define it if you want to use Boost.MPL
static asertions
</li>
</ul></div>
<p>
The default behavior is to use mpl assertions in this case, but setting BOOST_COMMON_TYPE_USES_STATIC_ASSERT
may reduce compile times and header dependencies somewhat.
</p>
<p>
Depending on the static assertion used you will have an hint of the failing
assertion either through the symbol or through the text.
</p>
<p>
When possible common_type is implemented using <code class="computeroutput"><span class="identifier">decltype</span></code>.
Otherwise when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is not defined it uses Boost.TypeOf.
</p>
<a name="boost_typetraits.reference.common_type.tutorial"></a><h5>
<a name="id928289"></a>
<a class="link" href="common_type.html#boost_typetraits.reference.common_type.tutorial">Tutorial</a>
</h5>
<p>
In a nutshell, <a class="link" href="common_type.html" title="common_type">common_type</a>
is a trait that takes 1 or more types, and returns a type which all of the
types will convert to. The default definition demands this conversion be
implicit. However the trait can be specialized for user-defined types which
want to limit their inter-type conversions to explicit, and yet still want
to interoperate with the <a class="link" href="common_type.html" title="common_type">common_type</a>
facility.
</p>
<p>
<span class="bold"><strong>Example:</strong></span>
</p>
<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">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
<span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
<span class="keyword">operator</span><span class="special">+(</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;,</span> <span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;);</span>
</pre>
<p>
In the above example, "mixed-mode" complex arithmetic is allowed.
The return type is described by <a class="link" href="common_type.html" title="common_type">common_type</a>.
For example the resulting type of adding a <code class="computeroutput"><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;</span></code> and <code class="computeroutput"><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span></code> might be a <code class="computeroutput"><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span></code>.
</p>
<p>
Here is how someone might produce a variadic comparison function:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">...&gt;::</span><span class="identifier">type</span>
<span class="identifier">min</span><span class="special">(</span><span class="identifier">T</span><span class="special">...</span> <span class="identifier">t</span><span class="special">);</span>
</pre>
<p>
This is a very useful and broadly applicable utility.
</p>
<a name="boost_typetraits.reference.common_type.how_to_get_the_common_type_of_types_with_explicit_conversions_"></a><h5>
<a name="id928590"></a>
<a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_to_get_the_common_type_of_types_with_explicit_conversions_">How
to get the common type of types with explicit conversions?</a>
</h5>
<p>
Another choice for the author of the preceding operator could be
</p>
<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">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
<span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;,</span> <span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span>
<span class="keyword">operator</span><span class="special">+(</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;,</span> <span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;);</span>
</pre>
<p>
As the default definition of <a class="link" href="common_type.html" title="common_type">common_type</a>
demands the conversion be implicit, we need to specialize the trait for complex
types as follows.
</p>
<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">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;,</span> <span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">complex</span><span class="special">&lt;</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<a name="boost_typetraits.reference.common_type.how_important_is_the_order_of_the_common_type_lt__gt__template_arguments_"></a><h5>
<a name="id928890"></a>
<a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_important_is_the_order_of_the_common_type_lt__gt__template_arguments_">How
important is the order of the common_type&lt;&gt; template arguments?</a>
</h5>
<p>
The order of the template parameters is important.
</p>
<p>
<code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">,</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is not equivalent to <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">&gt;::</span><span class="identifier">type</span></code>, but to <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
</p>
<p>
Consider
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">A</span> <span class="special">{};</span>
<span class="keyword">struct</span> <span class="identifier">B</span> <span class="special">{};</span>
<span class="keyword">struct</span> <span class="identifier">C</span> <span class="special">{</span>
<span class="identifier">C</span><span class="special">()</span> <span class="special">{}</span>
<span class="identifier">C</span><span class="special">(</span><span class="identifier">A</span> <span class="keyword">const</span><span class="special">&amp;)</span> <span class="special">{}</span>
<span class="identifier">C</span><span class="special">(</span><span class="identifier">B</span> <span class="keyword">const</span><span class="special">&amp;)</span> <span class="special">{}</span>
<span class="identifier">C</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="identifier">C</span> <span class="keyword">const</span><span class="special">&amp;)</span> <span class="special">{</span>
<span class="keyword">return</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">};</span>
</pre>
<p>
The following doesn't compile
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">,</span> <span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">ABC</span><span class="special">;</span> <span class="comment">// Does not compile
</span></pre>
<p>
while
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">ABC</span><span class="special">;</span>
</pre>
<p>
compiles.
</p>
<p>
Thus, as <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
is undefined, <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">,</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
is also undefined.
</p>
<p>
It is intended that clients who wish for <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span>
<span class="identifier">B</span><span class="special">&gt;</span></code>
to be well defined to define it themselves:
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span> <span class="special">{</span><span class="keyword">typedef</span> <span class="identifier">C</span> <span class="identifier">type</span><span class="special">;};</span>
<span class="special">}</span>
</pre>
<p>
Now this client can ask for <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span>
<span class="identifier">B</span><span class="special">,</span> <span class="identifier">C</span><span class="special">&gt;</span></code> (and
get the same answer).
</p>
<p>
Clients wanting to ask <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span>
<span class="identifier">B</span><span class="special">,</span> <span class="identifier">C</span><span class="special">&gt;</span></code> in
any order and get the same result need to add in addition:
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;&gt;</span> <span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">B</span><span class="special">,</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="special">:</span> <span class="keyword">public</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span> <span class="special">{};</span>
<span class="special">}</span>
</pre>
<p>
This is needed as the specialization of <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span>
<span class="identifier">B</span><span class="special">&gt;</span></code>
is not be used implicitly for <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">B</span><span class="special">,</span>
<span class="identifier">A</span><span class="special">&gt;</span></code>.
</p>
<a name="boost_typetraits.reference.common_type.can_the_common_type_of_two_types_be_a_third_type_"></a><h5>
<a name="id929759"></a>
<a class="link" href="common_type.html#boost_typetraits.reference.common_type.can_the_common_type_of_two_types_be_a_third_type_">Can
the common_type of two types be a third type?</a>
</h5>
<p>
Given the preceding example, one might expect <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">&gt;::</span><span class="identifier">type</span></code> to be <code class="computeroutput"><span class="identifier">C</span></code>
without any intervention from the user. But the default <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;&gt;</span></code> implementation doesn't grant that.
It is intended that clients who wish for <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span>
<span class="identifier">B</span><span class="special">&gt;</span></code>
to be well defined to define it themselves:
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span> <span class="special">{</span><span class="keyword">typedef</span> <span class="identifier">C</span> <span class="identifier">type</span><span class="special">;};</span>
<span class="keyword">template</span> <span class="special">&lt;&gt;</span> <span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">B</span><span class="special">,</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="special">:</span> <span class="keyword">public</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span> <span class="special">{};</span>
<span class="special">}</span>
</pre>
<p>
Now this client can ask for <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span>
<span class="identifier">B</span><span class="special">&gt;</span></code>.
</p>
<a name="boost_typetraits.reference.common_type.how_common_type_behaves_with_pointers_"></a><h5>
<a name="id930041"></a>
<a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_common_type_behaves_with_pointers_">How
common_type behaves with pointers?</a>
</h5>
<p>
Consider
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">C</span> <span class="special">{</span> <span class="special">}:</span>
<span class="keyword">struct</span> <span class="identifier">B</span> <span class="special">:</span> <span class="identifier">C</span> <span class="special">{</span> <span class="special">};</span>
<span class="keyword">struct</span> <span class="identifier">A</span> <span class="special">:</span> <span class="identifier">C</span> <span class="special">{</span> <span class="special">};</span>
</pre>
<p>
Shouldn't <code class="computeroutput"><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">*,</span><span class="identifier">B</span><span class="special">*&gt;::</span><span class="identifier">type</span></code>
be <code class="computeroutput"><span class="identifier">C</span><span class="special">*</span></code>?
I would say yes, but the default implementation will make it ill-formed.
</p>
<p>
The library could add a specialization for pointers, as
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">B</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">*,</span> <span class="identifier">B</span><span class="special">*&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;*</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<span class="special">}</span>
</pre>
<p>
But in the absence of a motivating use cases, we prefer not to add more than
the standard specifies.
</p>
<p>
Of course the user can always make this specialization.
</p>
<a name="boost_typetraits.reference.common_type.can_you_explain_the_pros_cons_of_common_type_against_boost_typeof_"></a><h5>
<a name="id930325"></a>
<a class="link" href="common_type.html#boost_typetraits.reference.common_type.can_you_explain_the_pros_cons_of_common_type_against_boost_typeof_">Can
you explain the pros/cons of common_type against Boost.Typeof?</a>
</h5>
<p>
Even if they appear to be close, <code class="computeroutput"><a class="link" href="common_type.html" title="common_type">common_type</a></code>
and <code class="computeroutput"><span class="identifier">typeof</span></code> have different
purposes. You use <code class="computeroutput"><span class="identifier">typeof</span></code>
to get the type of an expression, while you use <a class="link" href="common_type.html" title="common_type">common_type</a>
to set explicitly the type returned of a template function. Both are complementary,
and indeed <a class="link" href="common_type.html" title="common_type">common_type</a>
is equivalent to <code class="computeroutput"><span class="identifier">decltype</span><span class="special">(</span><a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">&gt;()</span>
<span class="special">?</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;()</span>
<span class="special">:</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;())</span></code>
</p>
<p>
<a class="link" href="common_type.html" title="common_type">common_type</a>
is also similar to promote_args&lt;class ...T&gt; in boost/math/tools/promotion.hpp,
though it is not exactly the same as promote_args either. <a class="link" href="common_type.html" title="common_type">common_type</a>&lt;T1,
T2&gt;::type simply represents the result of some operation on T1 and T2,
and defaults to the type obtained by putting T1 and T2 into a conditional
statement.
</p>
<p>
It is meant to be customizable (via specialization) if this default is not
appropriate.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2006 Adobe Systems Inc, David Abrahams,
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
Ramey and Jeremy Siek<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>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="alignment_of.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="decay.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
@@ -0,0 +1,117 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>common_type</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../reference.html" title="Alphabetical Reference">
<link rel="prev" href="alignment_of.html" title="alignment_of">
<link rel="next" href="decay.html" title="decay">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="alignment_of.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="decay.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.common_type_hpp"></a><a class="link" href="common_type_hpp.html" title="common_type"> common_type</a>
</h3></div></div></div>
<p>
<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">common_type</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="../../">common_type</a><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
<a class="link" href="../../">common_type</a>
is a traits class used to deduce a type common to a several types, useful
as the return type of functions operating on multiple input types such as
in mixed-mode arithmetic..
</p>
<p>
The nested typedef <code class="computeroutput"><span class="special">::</span><span class="identifier">type</span></code>
could be defined as follows:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">,</span> <span class="keyword">class</span> <span class="special">...</span><span class="identifier">V</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">U</span><span class="special">,...</span><span class="identifier">V</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">__common_type__</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">__common_type__</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">V</span><span class="special">...&gt;::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<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">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">T</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">decltype</span><span class="special">(</span><span class="identifier">__declval__</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">&gt;()</span> <span class="special">?</span> <span class="identifier">__declval__</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;()</span> <span class="special">:</span> <span class="identifier">__declval__</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;())</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
All parameter types must be complete. This trait is permitted to be specialized
by a user if at least one template parameter is a user-defined type. <span class="bold"><strong>Note:</strong></span> Such specializations are required when only
explicit conversions are desired among the <a class="link" href="../../">common_type</a>
arguments.
</p>
<a name="boost_typetraits.reference.common_type_hpp.configuration_macros"></a><h5>
<a name="id895242"></a>
<a class="link" href="common_type_hpp.html#boost_typetraits.reference.common_type_hpp.configuration_macros">Configuration
macros</a>
</h5>
<p>
When the compiler does not support static assertions then the user can select
the way static assertions are reported. Define
</p>
<div class="itemizedlist"><ul type="disc">
<li>
BOOST_COMMON_TYPE_USES_STATIC_ASSERT: define it if you want to use Boost.StaticAssert
</li>
<li>
BOOST_COMMON_TYPE_USES_MPL_ASSERT: define it if you want to use Boost.MPL
static asertions
</li>
</ul></div>
<p>
The default behavior is to use mpl assertions in this case, but setting BOOST_COMMON_TYPE_USES_STATIC_ASSERT
may reduce compile times and header dependencies somewhat.
</p>
<p>
Depending on the static assertion used you will have an hint of the failing
assertion either through the symbol or through the text.
</p>
<p>
When possible common_type is implemented using <code class="computeroutput"><span class="identifier">decltype</span></code>.
Otherwise when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is not defined it uses Boost.TypeOf.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2006 Adobe Systems Inc, David Abrahams,
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
Ramey and Jeremy Siek<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>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="alignment_of.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="decay.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&#160;1.&#160;Boost.TypeTraits">
<link rel="up" href="../reference.html" title="Alphabetical Reference">
<link rel="prev" href="alignment_of.html" title="alignment_of">
<link rel="prev" href="common_type.html" title="common_type">
<link rel="next" href="extent.html" title="extent">
</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="alignment_of.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="extent.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="common_type.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="extent.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">
@@ -48,7 +48,7 @@
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>
</p>
<div class="table">
<a name="id1064172"></a><p class="title"><b>Table&#160;1.12.&#160;Examples</b></p>
<a name="id930714"></a><p class="title"><b>Table&#160;1.12.&#160;Examples</b></p>
<div class="table-contents"><table class="table" summary="Examples">
<colgroup>
<col>
@@ -145,7 +145,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="alignment_of.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="extent.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="common_type.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="extent.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
@@ -49,7 +49,7 @@
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>
</p>
<div class="table">
<a name="id1065724"></a><p class="title"><b>Table&#160;1.13.&#160;Examples</b></p>
<a name="id933358"></a><p class="title"><b>Table&#160;1.13.&#160;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="id1066098"></a><p class="title"><b>Table&#160;1.14.&#160;Function Traits Members</b></p>
<a name="id933731"></a><p class="title"><b>Table&#160;1.14.&#160;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="id1066315"></a><p class="title"><b>Table&#160;1.15.&#160;Examples</b></p>
<a name="id933949"></a><p class="title"><b>Table&#160;1.15.&#160;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">&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>
</p>
<div class="table">
<a name="id1071961"></a><p class="title"><b>Table&#160;1.16.&#160;Examples</b></p>
<a name="id940687"></a><p class="title"><b>Table&#160;1.16.&#160;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">&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>
</p>
<div class="table">
<a name="id1093886"></a><p class="title"><b>Table&#160;1.17.&#160;Examples</b></p>
<a name="id961588"></a><p class="title"><b>Table&#160;1.17.&#160;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">&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>
</p>
<div class="table">
<a name="id1094368"></a><p class="title"><b>Table&#160;1.18.&#160;Examples</b></p>
<a name="id962071"></a><p class="title"><b>Table&#160;1.18.&#160;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">&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>
</p>
<div class="table">
<a name="id1094893"></a><p class="title"><b>Table&#160;1.19.&#160;Examples</b></p>
<a name="id963756"></a><p class="title"><b>Table&#160;1.19.&#160;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">&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>
</p>
<div class="table">
<a name="id1097629"></a><p class="title"><b>Table&#160;1.20.&#160;Examples</b></p>
<a name="id964853"></a><p class="title"><b>Table&#160;1.20.&#160;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">&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>
</p>
<div class="table">
<a name="id1098172"></a><p class="title"><b>Table&#160;1.21.&#160;Examples</b></p>
<a name="id965396"></a><p class="title"><b>Table&#160;1.21.&#160;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">&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>
</p>
<div class="table">
<a name="id1098703"></a><p class="title"><b>Table&#160;1.22.&#160;Examples</b></p>
<a name="id967020"></a><p class="title"><b>Table&#160;1.22.&#160;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">&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>
</p>
<div class="table">
<a name="id1099232"></a><p class="title"><b>Table&#160;1.23.&#160;Examples</b></p>
<a name="id967549"></a><p class="title"><b>Table&#160;1.23.&#160;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">&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>
</p>
<div class="table">
<a name="id1099787"></a><p class="title"><b>Table&#160;1.24.&#160;Examples</b></p>
<a name="id968103"></a><p class="title"><b>Table&#160;1.24.&#160;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">&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>
</p>
<div class="table">
<a name="id1100299"></a><p class="title"><b>Table&#160;1.25.&#160;Examples</b></p>
<a name="id968616"></a><p class="title"><b>Table&#160;1.25.&#160;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">&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>
</p>
<div class="table">
<a name="id1100801"></a><p class="title"><b>Table&#160;1.26.&#160;Examples</b></p>
<a name="id969118"></a><p class="title"><b>Table&#160;1.26.&#160;Examples</b></p>
<div class="table-contents"><table class="table" summary="Examples">
<colgroup>
<col>
+5 -2
View File
@@ -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="id1038564"></a><p>
<a name="id902030"></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>
@@ -75,6 +75,8 @@
of std::iter_swap</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/examples/to_double.html"> Convert Numeric
Types and Enums to double</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/examples/improved_min.html"> Improving std::min
with common_type</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="boost_typetraits/reference.html"> Alphabetical Reference</a></span></dt>
<dd><dl>
@@ -87,6 +89,7 @@
<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>
<dt><span class="section"><a href="boost_typetraits/reference/common_type.html"> common_type</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/decay.html"> decay</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/extent.html"> extent</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/floating_point_promotion.html">
@@ -168,7 +171,7 @@
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: July 01, 2010 at 17:14:17 +0100</small></p></td>
<td align="left"><p><small>Last revised: September 11, 2010 at 19:00:56 +0100</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
+3
View File
@@ -35,6 +35,9 @@ result of applying the transformation to the template argument `T`.
template <class T>
struct __add_volatile;
template <class... T>
struct __common_type;
template <class T>
struct __decay;
+2
View File
@@ -107,6 +107,7 @@
[def __add_const [link boost_typetraits.reference.add_const add_const]]
[def __add_volatile [link boost_typetraits.reference.add_volatile add_volatile]]
[def __add_cv [link boost_typetraits.reference.add_cv add_cv]]
[def __common_type [link boost_typetraits.reference.common_type common_type]]
[def __type_with_alignment [link boost_typetraits.reference.type_with_alignment type_with_alignment]]
[def __aligned_storage [link boost_typetraits.reference.aligned_storage aligned_storage]]
@@ -171,6 +172,7 @@ that is the result of the transformation.
[include add_volatile.qbk]
[include aligned_storage.qbk]
[include alignment_of.qbk]
[include common_type.qbk]
[include decay.qbk]
[include extent.qbk]
[include floating_point_promotion.qbk]