Added extra test cases for unbounded arrays.

Added new is_abstract test case.
Updated docs.


[SVN r21963]
This commit is contained in:
John Maddock
2004-01-26 12:17:57 +00:00
parent 9d9fc1f27b
commit 31bb52a34b
4 changed files with 70 additions and 44 deletions

View File

@@ -298,20 +298,20 @@
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::alignment_of&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">
<td valign="top" bgcolor="#c0c0c0"><code>::boost::alignment_of&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">
<P>Identifies the alignment requirements of T. Actually returns a value that is
only guaranteed to be a multiple of the actual alignment requirements of T.</P>
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" width="25%" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" width="5%">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_empty&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_empty&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">
<P>True if T is an empty struct or class. If the compiler implements the "zero
sized empty base classes" optimisation, then is_empty will correctly guess
whether T is empty. Relies upon is_class to determine whether T is a class
@@ -319,9 +319,9 @@
</P>
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0"><p align="center">10p5</p>
<td valign="top" bgcolor="#c0c0c0"><p align="center">10p5</p>
</td>
<td valign="top" width="25%" bgcolor="#c0c0c0"><p align="left">Relies on the compiler
<td valign="top" bgcolor="#c0c0c0"><p align="left">Relies on the compiler
implementing zero sized empty base classes in order to detect empty classes.
</p>
<p align="left">Can not be used with incomplete types.</p>
@@ -334,47 +334,58 @@
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_const&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">Evaluates to true only if T is
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_const&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">Evaluates to true only if T is
top-level const-qualified.</td>
<td valign="top" width="13%" bgcolor="#c0c0c0"><p align="center">3.9.3</p>
<td valign="top" bgcolor="#c0c0c0"><p align="center">3.9.3</p>
</td>
<td valign="top" width="25%" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" width="5%">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_volatile&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">Evaluates to true only if T is
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_volatile&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">Evaluates to true only if T is
volatile-qualified.</td>
<td valign="top" width="13%" bgcolor="#c0c0c0"><p align="center">3.9.3</p>
<td valign="top" bgcolor="#c0c0c0"><p align="center">3.9.3</p>
</td>
<td valign="top" width="25%" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" width="5%">&nbsp;</td>
</tr>
<TR>
<TD vAlign="top" width="5%"></TD>
<TD vAlign="top" bgColor="#c0c0c0">::boost::is_abstract&lt;T&gt;::value</TD>
<TD vAlign="top" bgColor="#c0c0c0">Evaluates true only if T is
abstract class.</TD>
<TD vAlign="top" bgColor="#c0c0c0">10.3</TD>
<TD vAlign="top" bgColor="#c0c0c0">Compiler must support DR337 (as Jan
2004: GCC 3.4,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VC++ 7.1, Intel C++ 7, Comeau 4.3.2).</TD>
<TD vAlign="top" width="5%"></TD>
</TR>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_polymorphic&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">Evaluates to true only if T is a
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_polymorphic&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">Evaluates to true only if T is a
polymorphic type.
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0">10.3</td>
<td valign="top" width="25%" bgcolor="#c0c0c0">Requires knowledge of the compilers
<td valign="top" bgcolor="#c0c0c0">10.3</td>
<td valign="top" bgcolor="#c0c0c0">Requires knowledge of the compilers
ABI, does actually seem to work with the majority of compilers though.</td>
<td valign="top" width="5%">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_pod&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">Evaluates to true only if T is a
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_pod&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">Evaluates to true only if T is a
cv-qualified POD type.
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0"><p align="center">3.9p10</p>
<td valign="top" bgcolor="#c0c0c0"><p align="center">3.9p10</p>
<p align="center">9p4</p>
</td>
<td valign="top" width="25%" bgcolor="#c0c0c0">Without some (as yet unspecified)
<td valign="top" bgcolor="#c0c0c0">Without some (as yet unspecified)
help from the compiler, is_pod will never report that a class or struct is a
POD; this is always safe, if possibly sub-optimal.<p>If the compiler does not
support partial-specialization of class templates, then this template can not
@@ -384,11 +395,11 @@
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::has_trivial_constructor&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">True if T has a trivial default
<td valign="top" bgcolor="#c0c0c0"><code>::boost::has_trivial_constructor&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">True if T has a trivial default
constructor.</td>
<td valign="top" width="13%" bgcolor="#c0c0c0">12.1p5</td>
<td valign="top" width="25%" bgcolor="#c0c0c0"><p align="left">Without some (as yet
<td valign="top" bgcolor="#c0c0c0">12.1p5</td>
<td valign="top" bgcolor="#c0c0c0"><p align="left">Without some (as yet
unspecified) help from the compiler, <code>has_trivial_constructor </code>will
never report that a class or struct has a trivial constructor; this is always
safe, if possibly sub-optimal.</p>
@@ -399,13 +410,13 @@
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::has_trivial_copy&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">True if T has a trivial copy
<td valign="top" bgcolor="#c0c0c0"><code>::boost::has_trivial_copy&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">True if T has a trivial copy
constructor.
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0">12.8p6</td>
<td valign="top" width="25%" bgcolor="#c0c0c0"><p align="left">Without some (as yet
<td valign="top" bgcolor="#c0c0c0">12.8p6</td>
<td valign="top" bgcolor="#c0c0c0"><p align="left">Without some (as yet
unspecified) help from the compiler, <code>has_trivial_copy </code>will never
report that a class or struct has a trivial copy constructor; this is always
safe, if possibly sub-optimal.</p>
@@ -416,13 +427,13 @@
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::has_trivial_assign&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">True if T has a trivial assignment
<td valign="top" bgcolor="#c0c0c0"><code>::boost::has_trivial_assign&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">True if T has a trivial assignment
operator.
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0">12.8p11</td>
<td valign="top" width="25%" bgcolor="#c0c0c0"><p align="left">Without some (as yet
<td valign="top" bgcolor="#c0c0c0">12.8p11</td>
<td valign="top" bgcolor="#c0c0c0"><p align="left">Without some (as yet
unspecified) help from the compiler, <code>has_trivial_assign </code>will never
report that a class or struct has a trivial assignment operator; this is always
safe, if possibly sub-optimal.</p>
@@ -433,12 +444,12 @@
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::has_trivial_destructor&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">True if T has a trivial destructor.
<td valign="top" bgcolor="#c0c0c0"><code>::boost::has_trivial_destructor&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">True if T has a trivial destructor.
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0">12.4p3</td>
<td valign="top" width="25%" bgcolor="#c0c0c0"><p align="left">Without some (as yet
<td valign="top" bgcolor="#c0c0c0">12.4p3</td>
<td valign="top" bgcolor="#c0c0c0"><p align="left">Without some (as yet
unspecified) help from the compiler, <code>has_trivial_destructor </code>will
never report that a class or struct has a trivial destructor; this is always
safe, if possibly sub-optimal.</p>
@@ -449,13 +460,13 @@
</tr>
<tr>
<td valign="top" width="5%">&nbsp;</td>
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_stateless&lt;T&gt;::value</code></td>
<td valign="top" width="28%" bgcolor="#c0c0c0">True if T is stateless, meaning
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_stateless&lt;T&gt;::value</code></td>
<td valign="top" bgcolor="#c0c0c0">True if T is stateless, meaning
that T has no storage and its constructors and destructors are trivial.
<P>T must be a complete type.</P>
</td>
<td valign="top" width="13%" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" width="25%" bgcolor="#c0c0c0"><p align="left">Without some (as yet
<td valign="top" bgcolor="#c0c0c0">&nbsp;</td>
<td valign="top" bgcolor="#c0c0c0"><p align="left">Without some (as yet
unspecified) help from the compiler, <code>is_stateless </code>will never
report that a class or struct is_stateless; this is always safe, if possibly
sub-optimal.</p>

View File

@@ -45,6 +45,7 @@ test-suite type_traits :
[ type-traits-run has_trivial_constr_test.cpp ]
[ type-traits-run has_trivial_copy_test.cpp ]
[ type-traits-run has_trivial_destructor_test.cpp ]
[ type-traits-run is_abstract_test.cpp ]
[ type-traits-run is_arithmetic_test.cpp ]
[ type-traits-run is_array_test.cpp ]
[ type-traits-run is_base_and_derived_test.cpp ]

View File

@@ -25,6 +25,9 @@ BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_10, ::boost::remove_bounds, const*,
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_11, ::boost::remove_bounds, volatile*, volatile*)
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_12, ::boost::remove_bounds, const[2][3], const[3])
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_13, ::boost::remove_bounds, (&)[2], (&)[2])
BOOST_DECL_TRANSFORM_TEST3(remove_bounds_test_14, ::boost::remove_bounds, [])
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_15, ::boost::remove_bounds, const [], const)
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_16, ::boost::remove_bounds, const[][3], const[3])
TT_TEST_BEGIN(remove_bounds)
@@ -41,6 +44,9 @@ TT_TEST_BEGIN(remove_bounds)
remove_bounds_test_11();
remove_bounds_test_12();
remove_bounds_test_13();
remove_bounds_test_14();
remove_bounds_test_15();
remove_bounds_test_16();
TT_TEST_END

View File

@@ -18,6 +18,14 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_class<incomplete_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_compound<incomplete_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<incomplete_type>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<incomplete_type>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<int[]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<int[][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<const int[]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<const int[][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<volatile int[]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<volatile int[][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<const volatile int[]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_array<const volatile int[][3]>::value, true);
TT_TEST_END