Merge branch 'is_final' of https://github.com/K-ballo/type_traits into develop

This commit is contained in:
jzmaddock
2014-08-20 17:22:23 +01:00
17 changed files with 333 additions and 12 deletions

View File

@ -38,6 +38,9 @@
for all types (but all have safe fallback positions if this support is unavailable):
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference/is_final.html" title="is_final">is_final</a>
</li>
<li class="listitem">
<a class="link" href="reference/is_union.html" title="is_union">is_union</a>
</li>
@ -360,7 +363,20 @@
</td>
<td>
<p>
Should evaluate to the alignment requirements of type T.
Should evaluate to the alignment requirements of type T
</p>
</td>
</tr>
<tr>
<td>
<p>
BOOST_IS_FINAL(T)
</p>
</td>
<td>
<p>
Should evaluate to true if T is a class type declared with the final
specifier
</p>
</td>
</tr>

View File

@ -109,6 +109,7 @@
<dt><span class="section"><a href="reference/is_copy_constructible.html">is_copy_constructible</a></span></dt>
<dt><span class="section"><a href="reference/is_empty.html">is_empty</a></span></dt>
<dt><span class="section"><a href="reference/is_enum.html">is_enum</a></span></dt>
<dt><span class="section"><a href="reference/is_final.html">is_final</a></span></dt>
<dt><span class="section"><a href="reference/is_floating_point.html">is_floating_point</a></span></dt>
<dt><span class="section"><a href="reference/is_function.html">is_function</a></span></dt>
<dt><span class="section"><a href="reference/is_fundamental.html">is_fundamental</a></span></dt>

View File

@ -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="is_empty.html" title="is_empty">
<link rel="next" href="is_floating_point.html" title="is_floating_point">
<link rel="next" href="is_final.html" title="is_final">
</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="is_empty.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="is_floating_point.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="is_empty.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="is_final.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
@ -94,7 +94,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="is_empty.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="is_floating_point.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="is_empty.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="is_final.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@ -0,0 +1,105 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>is_final</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<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="is_enum.html" title="is_enum">
<link rel="next" href="is_floating_point.html" title="is_floating_point">
</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="is_enum.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="is_floating_point.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_typetraits.reference.is_final"></a><a class="link" href="is_final.html" title="is_final">is_final</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">is_final</span> <span class="special">:</span> <span class="keyword">public</span> <em class="replaceable"><code><a class="link" href="integral_constant.html" title="integral_constant">true_type</a>-or-<a class="link" href="integral_constant.html" title="integral_constant">false_type</a></code></em> <span class="special">{};</span>
</pre>
<p>
<span class="bold"><strong>Inherits:</strong></span> If T is a (possibly cv-qualified)
class type declared with the final specifier type then inherits from <a class="link" href="integral_constant.html" title="integral_constant">true_type</a>,
otherwise inherits from <a class="link" href="integral_constant.html" title="integral_constant">false_type</a>.
Currently requires some kind of compiler support.
</p>
<p>
<span class="bold"><strong>C++ Standard Reference:</strong></span> 9p3.
</p>
<p>
<span class="bold"><strong>Compiler Compatibility:</strong></span> Without (some as
yet unspecified) help from the compiler, we cannot detect class types declared
with the final specifier using only standard C++, as a result this type will
never inherit from <a class="link" href="integral_constant.html" title="integral_constant">true_type</a>,
unless the user explicitly specializes the template for their user-defined
final class types, or unless the compiler supplies some unspecified intrinsic
that implements this functionality. Currently (Aug 2014) compilers more recent
than GCC-4.7, and Clang have the necessary compiler <a class="link" href="../intrinsics.html" title="Support for Compiler Intrinsics">intrinsics</a>
to ensure that this trait "just works". You may also test to see
if the necessary <a class="link" href="../intrinsics.html" title="Support for Compiler Intrinsics">intrinsics</a>
are available by checking to see if the macro <code class="computeroutput"><span class="identifier">BOOST_IS_FINAL</span></code>
is defined.
</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">is_final</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>
<p>
<span class="bold"><strong>Examples:</strong></span>
</p>
<p>
Given <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">my_final</span>
<span class="identifier">final</span> <span class="special">{};</span></code>
then:
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
<code class="computeroutput"><span class="identifier">is_final</span><span class="special">&lt;</span><span class="identifier">my_final</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_final</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">my_final</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_final</span><span class="special">&lt;</span><span class="identifier">my_final</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_final</span><span class="special">&lt;</span><span class="identifier">my_final</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>
<code class="computeroutput"><span class="identifier">is_final</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code> is the type <code class="computeroutput"><span class="keyword">bool</span></code>.
</p></blockquote></div>
</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, 2011 Adobe Systems Inc, David Abrahams,
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
Watanabe<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="is_enum.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="is_floating_point.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<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="is_enum.html" title="is_enum">
<link rel="prev" href="is_final.html" title="is_final">
<link rel="next" href="is_function.html" title="is_function">
</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="is_enum.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="is_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="is_final.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="is_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
@ -74,7 +74,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="is_enum.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="is_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
<a accesskey="p" href="is_final.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="is_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@ -165,6 +165,7 @@
<dt><span class="section"><a href="boost_typetraits/reference/is_copy_constructible.html">is_copy_constructible</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/is_empty.html">is_empty</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/is_enum.html">is_enum</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/is_final.html">is_final</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/is_floating_point.html">is_floating_point</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/is_function.html">is_function</a></span></dt>
<dt><span class="section"><a href="boost_typetraits/reference/is_fundamental.html">is_fundamental</a></span></dt>

View File

@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="idm1547583856"></a>Class Index</h2></div></div></div>
<a name="id1059097"></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">N</a> <a class="link" href="s11.html#idx_id_10">O</a> <a class="link" href="s11.html#idx_id_11">P</a> <a class="link" href="s11.html#idx_id_12">R</a> <a class="link" href="s11.html#idx_id_13">T</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@ -235,6 +235,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_copy_constructible.html" title="is_copy_constructible"><span class="index-entry-level-0">is_copy_constructible</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_empty.html" title="is_empty"><span class="index-entry-level-0">is_empty</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_enum.html" title="is_enum"><span class="index-entry-level-0">is_enum</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_final.html" title="is_final"><span class="index-entry-level-0">is_final</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_floating_point.html" title="is_floating_point"><span class="index-entry-level-0">is_floating_point</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_function.html" title="is_function"><span class="index-entry-level-0">is_function</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_fundamental.html" title="is_fundamental"><span class="index-entry-level-0">is_fundamental</span></a></p></li>

View File

@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="idm1547326576"></a>Typedef Index</h2></div></div></div>
<a name="id1064196"></a>Typedef Index</h2></div></div></div>
<p><a class="link" href="s12.html#idx_id_15">A</a> <a class="link" href="s12.html#idx_id_20">F</a> <a class="link" href="s12.html#idx_id_27">R</a> <a class="link" href="s12.html#idx_id_28">T</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>

View File

@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="idm1547304048"></a>Macro Index</h2></div></div></div>
<a name="id1064408"></a>Macro Index</h2></div></div></div>
<p><a class="link" href="s13.html#idx_id_31">B</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@ -141,6 +141,13 @@
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">Macros for Compiler Intrinsics</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">BOOST_IS_FINAL</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_final.html" title="is_final"><span class="index-entry-level-1">is_final</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">Macros for Compiler Intrinsics</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">BOOST_IS_POD</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_pod.html" title="is_pod"><span class="index-entry-level-1">is_pod</span></a></p></li>

View File

@ -23,7 +23,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="idm1547245040"></a>Index</h2></div></div></div>
<a name="id1065039"></a>Index</h2></div></div></div>
<p><a class="link" href="s14.html#idx_id_45">A</a> <a class="link" href="s14.html#idx_id_46">B</a> <a class="link" href="s14.html#idx_id_47">C</a> <a class="link" href="s14.html#idx_id_48">D</a> <a class="link" href="s14.html#idx_id_49">E</a> <a class="link" href="s14.html#idx_id_50">F</a> <a class="link" href="s14.html#idx_id_51">H</a> <a class="link" href="s14.html#idx_id_52">I</a> <a class="link" href="s14.html#idx_id_53">M</a> <a class="link" href="s14.html#idx_id_54">N</a> <a class="link" href="s14.html#idx_id_55">O</a> <a class="link" href="s14.html#idx_id_56">P</a> <a class="link" href="s14.html#idx_id_57">R</a> <a class="link" href="s14.html#idx_id_58">T</a> <a class="link" href="s14.html#idx_id_59">U</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@ -186,6 +186,13 @@
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">Macros for Compiler Intrinsics</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">BOOST_IS_FINAL</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_final.html" title="is_final"><span class="index-entry-level-1">is_final</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">Macros for Compiler Intrinsics</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">BOOST_IS_POD</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_pod.html" title="is_pod"><span class="index-entry-level-1">is_pod</span></a></p></li>
@ -746,6 +753,13 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_enum.html" title="is_enum"><span class="index-entry-level-0">is_enum</span></a></p></li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">is_final</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_final.html" title="is_final"><span class="index-entry-level-1">BOOST_IS_FINAL</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><span class="bold"><strong><a class="link" href="../boost_typetraits/reference/is_final.html" title="is_final"><span class="index-entry-level-1">is_final</span></a></strong></span></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_floating_point.html" title="is_floating_point"><span class="index-entry-level-0">is_floating_point</span></a></p></li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">is_function</span></p>
@ -828,6 +842,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_CONVERTIBLE</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_EMPTY</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_ENUM</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_FINAL</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_POD</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_POLYMORPHIC</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/intrinsics.html#boost_typetraits.intrinsics.macros_for_compiler_intrinsics" title="Table&#160;1.9.&#160;Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_UNION</span></a></p></li>

View File

@ -17,6 +17,7 @@ The Following traits classes always need compiler support to do the right thing
for all types
(but all have safe fallback positions if this support is unavailable):
* __is_final
* __is_union
* __is_pod
* __has_trivial_constructor
@ -67,7 +68,8 @@ a matter of defining one of more of the following macros:
[[BOOST_IS_CONVERTIBLE(T,U)][Should evaluate to true if T is convertible to U]]
[[BOOST_IS_ENUM(T)][Should evaluate to true is T is an enum]]
[[BOOST_IS_POLYMORPHIC(T)][Should evaluate to true if T is a polymorphic type]]
[[BOOST_ALIGNMENT_OF(T)][Should evaluate to the alignment requirements of type T.]]
[[BOOST_ALIGNMENT_OF(T)][Should evaluate to the alignment requirements of type T]]
[[BOOST_IS_FINAL(T)][Should evaluate to true if T is a class type declared with the final specifier]]
]

47
doc/is_final.qbk Normal file
View File

@ -0,0 +1,47 @@
[/
Copyright (c) 2014 Agustin Berge
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
[section:is_final is_final]
template <class T>
struct is_final : public __tof {};
__inherit If T is a (possibly cv-qualified) class type declared with the final
specifier type then inherits from __true_type, otherwise inherits from __false_type.
Currently requires some kind of compiler support.
__std_ref 9p3.
__compat Without (some as yet unspecified) help from the compiler, we cannot detect
class types declared with the final specifier using only standard C++,
as a result this type will never inherit from __true_type, unless the user explicitly
specializes the template for their user-defined final class types, or unless the compiler
supplies some unspecified intrinsic that implements this functionality.
Currently (Aug 2014) compilers more recent than GCC-4.7, and Clang
have the necessary compiler __intrinsics to ensure that this
trait "just works". You may also test to see if the necessary __intrinsics are available
by checking to see if the macro `BOOST_IS_FINAL` is defined.
__header ` #include <boost/type_traits/is_final.hpp>` or ` #include <boost/type_traits.hpp>`
__examples
Given `struct my_final final {};` then:
[:`is_final<my_final>` inherits from `__true_type`.]
[:`is_final<const my_final>::type` is the type `__true_type`.]
[:`is_final<my_final>::value` is an integral constant
expression that evaluates to /true/.]
[:`is_final<my_final*>::value` is an integral constant
expression that evaluates to /false/.]
[:`is_final<T>::value_type` is the type `bool`.]
[endsect]

View File

@ -76,6 +76,7 @@
[def __is_unsigned [link boost_typetraits.reference.is_unsigned is_unsigned]]
[def __has_virtual_destructor [link boost_typetraits.reference.has_virtual_destructor has_virtual_destructor]]
[def __is_pod [link boost_typetraits.reference.is_pod is_pod]]
[def __is_final [link boost_typetraits.reference.is_final is_final]]
[def __has_trivial_constructor [link boost_typetraits.reference.has_trivial_constructor has_trivial_constructor]]
[def __has_new_operator [link boost_typetraits.reference.has_new_operator has_new_operator]]
[def __has_trivial_copy [link boost_typetraits.reference.has_trivial_copy has_trivial_copy]]
@ -263,6 +264,7 @@ See __has_trivial_constructor.
[include is_copy_constructible.qbk]
[include is_empty.qbk]
[include is_enum.qbk]
[include is_final.qbk]
[include is_floating_point.qbk]
[include is_function.qbk]
[include is_fundamental.qbk]

View File

@ -197,6 +197,9 @@
# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T)
# endif
# define BOOST_ALIGNMENT_OF(T) __alignof(T)
# if __has_feature(is_final)
# define BOOST_IS_FINAL(T) __is_final(T)
# endif
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
@ -262,6 +265,9 @@
# define BOOST_IS_ENUM(T) __is_enum(T)
# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
# define BOOST_ALIGNMENT_OF(T) __alignof__(T)
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
# define BOOST_IS_FINAL(T) __is_final(T)
# endif
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif

View File

@ -0,0 +1,41 @@
// Copyright (c) 2014 Agustin Berge
//
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_TT_IS_FINAL_HPP_INCLUDED
#define BOOST_TT_IS_FINAL_HPP_INCLUDED
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/config.hpp>
#include <boost/type_traits/intrinsics.hpp>
// should be the last #include
#include <boost/type_traits/detail/bool_trait_def.hpp>
namespace boost {
namespace detail {
template <typename T> struct is_final_impl
{
#ifdef BOOST_IS_FINAL
typedef typename remove_cv<T>::type cvt;
BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_FINAL(cvt));
#else
BOOST_STATIC_CONSTANT(bool, value = false);
#endif
};
} // namespace detail
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_final,T,::boost::detail::is_final_impl<T>::value)
} // namespace boost
#include <boost/type_traits/detail/bool_trait_undef.hpp>
#endif // BOOST_TT_IS_FINAL_HPP_INCLUDED

72
test/is_final_test.cpp Normal file
View File

@ -0,0 +1,72 @@
// Copyright (c) 2014 Agustin Berge
//
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/is_final.hpp>
#endif
#include <iostream>
TT_TEST_BEGIN(is_final)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<int>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<const int>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<volatile int>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<int*>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<int* const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<int&>::value, false);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<mf4>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<f1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<enum_UDT>::value, false);
#if defined(BOOST_HAS_TYPE_TRAITS_INTRINSICS)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<final_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<final_UDT const>::value, true);
#else
std::cout <<
"\n<note>\n"
"This compiler version does not provide support for is_final on\n"
"final types.n"
"</note>\n";
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<UDT const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<UDT volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<std::iostream>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<UDT*>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<UDT[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<UDT&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<void>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<test_abc1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<foo0_t>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<foo1_t>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<foo2_t>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<foo3_t>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<foo4_t>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<incomplete_type>::value, false);
TT_TEST_END

View File

@ -265,6 +265,11 @@ struct nothrow_construct_UDT
{ return true; }
};
#ifndef BOOST_NO_CXX11_FINAL
struct final_UDT final
{};
#endif
class Base { };
class Derived : public Base { };