Merge minor type traits fixes from Trunk.

[SVN r74575]
This commit is contained in:
John Maddock
2011-09-26 12:19:40 +00:00
parent 5976893b1a
commit 33db0b59ed
10 changed files with 84 additions and 16 deletions

View File

@ -16,7 +16,7 @@ __header ` #include <boost/type_traits/conditional.hpp>` or ` #include <boost/ty
template <bool B, class T, class U> struct __conditional;
}
If B is true, the member typedef type shall equal T. If B is false, the member typedef type shall equal F.
If B is true, the member typedef type shall equal T. If B is false, the member typedef type shall equal U.
This trait is really just an alias for `boost::mpl::if_c`.

View File

@ -37,7 +37,7 @@
</pre>
<p>
If B is true, the member typedef type shall equal T. If B is false, the member
typedef type shall equal F.
typedef type shall equal U.
</p>
<p>
This trait is really just an alias for <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">if_c</span></code>.

View File

@ -62,20 +62,24 @@
<p>
<span class="bold"><strong>Examples:</strong></span>
</p>
<p>
Given <code class="computeroutput"><span class="keyword">union</span> <span class="identifier">my_union</span>
<span class="special">{};</span></code> then:
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span></code>
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="identifier">my_union</span><span class="special">&gt;</span></code>
inherits from <code class="computeroutput"><a class="link" href="integral_constant.html" title="integral_constant">true_type</a></code>.
</p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">my_union</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
is the type <code class="computeroutput"><a class="link" href="integral_constant.html" title="integral_constant">true_type</a></code>.
</p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;::</span><span class="identifier">value</span></code> is an integral constant expression
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="identifier">my_union</span><span class="special">&gt;::</span><span class="identifier">value</span></code> is an integral constant expression
that evaluates to <span class="emphasis"><em>true</em></span>.
</p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">*&gt;::</span><span class="identifier">value</span></code> is an integral constant expression
<code class="computeroutput"><span class="identifier">is_union</span><span class="special">&lt;</span><span class="identifier">my_union</span><span class="special">*&gt;::</span><span class="identifier">value</span></code> is an integral constant expression
that evaluates to <span class="emphasis"><em>false</em></span>.
</p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>

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="id893499"></a><p>
<a name="id1003484"></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>

View File

@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id967562"></a>Class Index</h2></div></div></div>
<a name="id1076316"></a>Class Index</h2></div></div></div>
<p><a class="link" href="s11.html#idx_id_0">A</a> <a class="link" href="s11.html#idx_id_2">C</a> <a class="link" href="s11.html#idx_id_3">D</a> <a class="link" href="s11.html#idx_id_4">E</a> <a class="link" href="s11.html#idx_id_5">F</a> <a class="link" href="s11.html#idx_id_6">H</a> <a class="link" href="s11.html#idx_id_7">I</a> <a class="link" href="s11.html#idx_id_8">M</a> <a class="link" href="s11.html#idx_id_9">P</a> <a class="link" href="s11.html#idx_id_10">R</a> <a class="link" href="s11.html#idx_id_11">T</a></p>
<div class="variablelist"><dl>
<dt>

View File

@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id968602"></a>Typedef Index</h2></div></div></div>
<a name="id1077356"></a>Typedef Index</h2></div></div></div>
<p><a class="link" href="s12.html#idx_id_18">F</a> <a class="link" href="s12.html#idx_id_23">R</a> <a class="link" href="s12.html#idx_id_24">T</a></p>
<div class="variablelist"><dl>
<dt>

View File

@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id968712"></a>Macro Index</h2></div></div></div>
<a name="id1077466"></a>Macro Index</h2></div></div></div>
<p><a class="link" href="s13.html#idx_id_27">B</a></p>
<div class="variablelist"><dl>
<dt>

View File

@ -23,7 +23,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id969254"></a>Index</h2></div></div></div>
<a name="id1078008"></a>Index</h2></div></div></div>
<p><a class="link" href="s14.html#idx_id_39">A</a> <a class="link" href="s14.html#idx_id_40">B</a> <a class="link" href="s14.html#idx_id_41">C</a> <a class="link" href="s14.html#idx_id_42">D</a> <a class="link" href="s14.html#idx_id_43">E</a> <a class="link" href="s14.html#idx_id_44">F</a> <a class="link" href="s14.html#idx_id_45">H</a> <a class="link" href="s14.html#idx_id_46">I</a> <a class="link" href="s14.html#idx_id_47">M</a> <a class="link" href="s14.html#idx_id_48">P</a> <a class="link" href="s14.html#idx_id_49">R</a> <a class="link" href="s14.html#idx_id_50">T</a> <a class="link" href="s14.html#idx_id_51">U</a></p>
<div class="variablelist"><dl>
<dt>

View File

@ -30,14 +30,16 @@ __header ` #include <boost/type_traits/is_union.hpp>` or ` #include <boost/type_
__examples
[:`is_union<void>` inherits from `__true_type`.]
Given `union my_union {};` then:
[:`is_union<const void>::type` is the type `__true_type`.]
[:`is_union<my_union>` inherits from `__true_type`.]
[:`is_union<void>::value` is an integral constant
[:`is_union<const my_union>::type` is the type `__true_type`.]
[:`is_union<my_union>::value` is an integral constant
expression that evaluates to /true/.]
[:`is_union<void*>::value` is an integral constant
[:`is_union<my_union*>::value` is an integral constant
expression that evaluates to /false/.]
[:`is_union<T>::value_type` is the type `bool`.]

View File

@ -1,4 +1,3 @@
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -124,6 +123,68 @@
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
#if defined(BOOST_CLANG) && defined(__has_feature)
# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/is_volatile.hpp>
# if __has_feature(is_union)
# define BOOST_IS_UNION(T) __is_union(T)
# endif
# if __has_feature(is_pod) && defined(_LIBCPP_VERSION)
# define BOOST_IS_POD(T) __is_pod(T)
# endif
# if __has_feature(is_empty) && defined(_LIBCPP_VERSION)
# define BOOST_IS_EMPTY(T) __is_empty(T)
# endif
# if __has_feature(has_trivial_constructor)
# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
# endif
# if __has_feature(has_trivial_copy)
# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value)
# endif
# if __has_feature(has_trivial_assign)
# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value)
# endif
# if __has_feature(has_trivial_destructor)
# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
# endif
# if __has_feature(has_nothrow_constructor)
# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
# endif
# if __has_feature(has_nothrow_copy)
# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value)
# endif
# if __has_feature(has_nothrow_assign)
# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value)
# endif
# if __has_feature(has_virtual_destructor)
# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
# endif
# if __has_feature(is_abstract)
# define BOOST_IS_ABSTRACT(T) __is_abstract(T)
# endif
# if __has_feature(is_base_of)
# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
# endif
# if __has_feature(is_class)
# define BOOST_IS_CLASS(T) __is_class(T)
# endif
# if __has_feature(is_convertible_to)
# include <boost/type_traits/is_abstract.hpp>
# define BOOST_IS_CONVERTIBLE(T,U) (__is_convertible_to(T,U) && !::boost::is_abstract<U>::value)
# endif
# if __has_feature(is_enum)
# define BOOST_IS_ENUM(T) __is_enum(T)
# endif
# if __has_feature(is_polymorphic)
# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
# endif
# define BOOST_ALIGNMENT_OF(T) __alignof(T)
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__)))
# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/is_reference.hpp>
@ -224,3 +285,4 @@