forked from boostorg/type_traits
Merge branch 'develop'
This commit is contained in:
@ -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>
|
||||
|
@ -107,8 +107,10 @@
|
||||
<dt><span class="section"><a href="reference/is_const.html">is_const</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_convertible.html">is_convertible</a></span></dt>
|
||||
<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_copy_assignable.html">is_copy_assignable</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>
|
||||
|
106
doc/html/boost_typetraits/reference/is_copy_assignable.html
Normal file
106
doc/html/boost_typetraits/reference/is_copy_assignable.html
Normal file
@ -0,0 +1,106 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>is_copy_assignable</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 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="is_copy_constructible.html" title="is_copy_constructible">
|
||||
<link rel="next" href="is_empty.html" title="is_empty">
|
||||
</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_copy_constructible.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_empty.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_copy_assignable"></a><a class="link" href="is_copy_assignable.html" title="is_copy_assignable">is_copy_assignable</a>
|
||||
</h3></div></div></div>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">is_copy_assignable</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 <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
is <code class="computeroutput"><span class="identifier">CopyAssignable</span></code> (i.e. has
|
||||
an accessible explicit or implicit copy assignment operator), 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>.
|
||||
Type <code class="computeroutput"><span class="identifier">T</span></code> must be a complete
|
||||
type.
|
||||
</p>
|
||||
<p>
|
||||
In other words, inherits from <a class="link" href="integral_constant.html" title="integral_constant">true_type</a>
|
||||
only if copy assignment of <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
from <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">T</span>
|
||||
<span class="special">&</span></code> is not marked with <code class="computeroutput"><span class="special">=</span> <span class="keyword">delete</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">T</span></code> does not derives from
|
||||
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">noncopyable</span></code> and is not marked with <code class="computeroutput"><span class="identifier">BOOST_MOVABLE_BUT_NOT_COPYABLE</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial-specialization of class templates, then this template
|
||||
can not be used.
|
||||
</p>
|
||||
<p>
|
||||
If your compiler does not support C++11 deleted functions (<code class="computeroutput"><span class="special">=</span> <span class="keyword">delete</span></code>)
|
||||
or does not support SFINAE for the deleted assignments, then derive your
|
||||
classes from <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">noncopyable</span></code> or mark them with <code class="computeroutput"><span class="identifier">BOOST_MOVABLE_BUT_NOT_COPYABLE</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span></code> to show
|
||||
that class is non-assignable.
|
||||
</p>
|
||||
<p>
|
||||
Trait does not care about access modifiers, so if you see errors like this:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="char">'T::operator=(const T&)'</span> <span class="identifier">is</span> <span class="keyword">private</span>
|
||||
<span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">is_copy_assignable</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">:</span><span class="number">68</span><span class="special">:</span><span class="number">5</span><span class="special">:</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">within</span> <span class="keyword">this</span> <span class="identifier">context</span>
|
||||
</pre>
|
||||
<p>
|
||||
then you are trying to call that macro for a structure with private assignment:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">T</span> <span class="special">{</span>
|
||||
<span class="comment">// ...</span>
|
||||
<span class="keyword">private</span><span class="special">:</span>
|
||||
<span class="identifier">T</span> <span class="special">&</span><span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">&);</span>
|
||||
<span class="comment">// ...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
To fix that you must modify your structure, explicitly marking it as noncopyable
|
||||
(<code class="computeroutput"><span class="special">=</span> <span class="keyword">delete</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">noncopyable</span></code> or <code class="computeroutput"><span class="identifier">BOOST_MOVABLE_BUT_NOT_COPYABLE</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span></code>)
|
||||
or explicitly <a class="link" href="../user_defined.html" title="User Defined Specializations">specializing
|
||||
the trait</a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">is_copy_assignable</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
</div>
|
||||
<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 © 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_copy_constructible.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_empty.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="is_convertible.html" title="is_convertible">
|
||||
<link rel="next" href="is_empty.html" title="is_empty">
|
||||
<link rel="next" href="is_copy_assignable.html" title="is_copy_assignable">
|
||||
</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_convertible.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_empty.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="is_convertible.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_copy_assignable.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@ -97,7 +97,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="is_convertible.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_empty.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="is_convertible.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_copy_assignable.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.78.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="is_copy_constructible.html" title="is_copy_constructible">
|
||||
<link rel="prev" href="is_copy_assignable.html" title="is_copy_assignable">
|
||||
<link rel="next" href="is_enum.html" title="is_enum">
|
||||
</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_copy_constructible.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_enum.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="is_copy_assignable.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_enum.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@ -103,7 +103,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="is_copy_constructible.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_enum.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="is_copy_assignable.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_enum.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="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>
|
||||
|
105
doc/html/boost_typetraits/reference/is_final.html
Normal file
105
doc/html/boost_typetraits/reference/is_final.html
Normal 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 1. 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"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></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"><</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">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<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"><</span><span class="identifier">my_final</span><span class="special">></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"><</span><span class="keyword">const</span> <span class="identifier">my_final</span><span class="special">>::</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"><</span><span class="identifier">my_final</span><span class="special">>::</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"><</span><span class="identifier">my_final</span><span class="special">*>::</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"><</span><span class="identifier">T</span><span class="special">>::</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 © 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>
|
@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. 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>
|
||||
|
@ -40,8 +40,8 @@
|
||||
</p>
|
||||
<p>
|
||||
In other words, inherits from <a class="link" href="integral_constant.html" title="integral_constant">true_type</a>
|
||||
only if expression <code class="computeroutput"><span class="identifier">varaible1</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">varaible2</span><span class="special">)</span></code> won't throw (<code class="computeroutput"><span class="identifier">varaible1</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">varaible2</span></code> are variables
|
||||
only if expression <code class="computeroutput"><span class="identifier">variable1</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">variable2</span><span class="special">)</span></code> won't throw (<code class="computeroutput"><span class="identifier">variable1</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">variable2</span></code> are variables
|
||||
of type <code class="computeroutput"><span class="identifier">T</span></code>).
|
||||
</p>
|
||||
<p>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</p>
|
||||
<p>
|
||||
In other words, inherits from <a class="link" href="integral_constant.html" title="integral_constant">true_type</a>
|
||||
only if expression <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">varaible1</span><span class="special">))</span></code> won't throw (<code class="computeroutput"><span class="identifier">varaible1</span></code>
|
||||
only if expression <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">variable1</span><span class="special">))</span></code> won't throw (<code class="computeroutput"><span class="identifier">variable1</span></code>
|
||||
is a variable of type <code class="computeroutput"><span class="identifier">T</span></code>).
|
||||
</p>
|
||||
<p>
|
||||
|
@ -163,8 +163,10 @@
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/is_const.html">is_const</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_typetraits/reference/is_convertible.html">is_convertible</a></span></dt>
|
||||
<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_copy_assignable.html">is_copy_assignable</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>
|
||||
|
@ -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="idm1546652624"></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>
|
||||
@ -232,9 +232,11 @@
|
||||
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_compound.html" title="is_compound"><span class="index-entry-level-0">is_compound</span></a></p></li>
|
||||
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_const.html" title="is_const"><span class="index-entry-level-0">is_const</span></a></p></li>
|
||||
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_convertible.html" title="is_convertible"><span class="index-entry-level-0">is_convertible</span></a></p></li>
|
||||
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_copy_assignable.html" title="is_copy_assignable"><span class="index-entry-level-0">is_copy_assignable</span></a></p></li>
|
||||
<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>
|
||||
|
@ -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="idm1546254288"></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>
|
||||
|
@ -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="idm1546231760"></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 1.9. 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 1.9. 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>
|
||||
|
@ -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="idm1546169680"></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 1.9. 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 1.9. 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>
|
||||
@ -737,6 +744,7 @@
|
||||
<p><span class="index-entry-level-0">is_convertible_to_Ret</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/category/value_traits/operators.html" title="Operator Type Traits"><span class="index-entry-level-1">Operator Type Traits</span></a></p></li></ul></div>
|
||||
</li>
|
||||
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_typetraits/reference/is_copy_assignable.html" title="is_copy_assignable"><span class="index-entry-level-0">is_copy_assignable</span></a></p></li>
|
||||
<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><span class="index-entry-level-0">is_empty</span></p>
|
||||
@ -746,6 +754,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 +843,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 1.9. 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 1.9. 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 1.9. 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 1.9. 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 1.9. 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 1.9. 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 1.9. Macros for Compiler Intrinsics"><span class="index-entry-level-1">BOOST_IS_UNION</span></a></p></li>
|
||||
|
@ -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]]
|
||||
|
||||
]
|
||||
|
||||
|
51
doc/is_copy_assignable.qbk
Normal file
51
doc/is_copy_assignable.qbk
Normal file
@ -0,0 +1,51 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Copyright 2014 Ion Gaztanaga.
|
||||
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_copy_assignable is_copy_assignable]
|
||||
|
||||
template <class T>
|
||||
struct is_copy_assignable : public __tof {};
|
||||
|
||||
__inherit If `T` is `CopyAssignable` (i.e. has an accessible explicit or implicit copy assignment operator),
|
||||
then inherits from __true_type, otherwise inherits from __false_type. Type `T`
|
||||
must be a complete type.
|
||||
|
||||
In other words, inherits from __true_type only if copy assignment of `T` from `const T &` is not
|
||||
marked with `= delete`, `T` does not derives from `boost::noncopyable` and
|
||||
is not marked with `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)`.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used.
|
||||
|
||||
If your compiler does not support C++11 deleted functions (`= delete`) or does not support
|
||||
SFINAE for the deleted assignments, then derive your classes from `boost::noncopyable` or
|
||||
mark them with `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)` to show that class is non-assignable.
|
||||
|
||||
Trait does not care about access modifiers, so if you see errors like this:
|
||||
|
||||
'T::operator=(const T&)' is private
|
||||
boost/type_traits/is_copy_assignable.hpp:68:5: error: within this context
|
||||
|
||||
then you are trying to call that macro for a structure with private assignment:
|
||||
|
||||
struct T {
|
||||
// ...
|
||||
private:
|
||||
T &operator=(const T &);
|
||||
// ...
|
||||
};
|
||||
|
||||
To fix that you must modify your structure, explicitly marking it as noncopyable (`= delete`,
|
||||
`boost::noncopyable` or `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)`) or explicitly
|
||||
[link boost_typetraits.user_defined specializing the trait].
|
||||
|
||||
|
||||
__header ` #include <boost/type_traits/is_copy_assignable.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[endsect]
|
||||
|
47
doc/is_final.qbk
Normal file
47
doc/is_final.qbk
Normal 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]
|
||||
|
@ -16,8 +16,8 @@ or a type without move assignment-operator but with non-throwing assignment-oper
|
||||
then inherits from __true_type, otherwise inherits from __false_type. Type `T`
|
||||
must be a complete type.
|
||||
|
||||
In other words, inherits from __true_type only if expression `varaible1 = std::move(varaible2)`
|
||||
won't throw (`varaible1` and `varaible2` are variables of type `T`).
|
||||
In other words, inherits from __true_type only if expression `variable1 = std::move(variable2)`
|
||||
won't throw (`variable1` and `variable2` are variables of type `T`).
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
@ -16,8 +16,8 @@ or a type without move-constructor but with non-throwing copy-constructor,
|
||||
then inherits from __true_type, otherwise inherits from __false_type. Type `T`
|
||||
must be a complete type.
|
||||
|
||||
In other words, inherits from __true_type only if expression `T(std::move(varaible1))`
|
||||
won't throw (`varaible1` is a variable of type `T`).
|
||||
In other words, inherits from __true_type only if expression `T(std::move(variable1))`
|
||||
won't throw (`variable1` is a variable of type `T`).
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
@ -69,6 +69,7 @@
|
||||
[def __is_empty [link boost_typetraits.reference.is_empty is_empty]]
|
||||
[def __is_const [link boost_typetraits.reference.is_const is_const]]
|
||||
[def __is_copy_constructible [link boost_typetraits.reference.is_copy_constructible is_copy_constructible]]
|
||||
[def __is_copy_assignable [link boost_typetraits.reference.is_copy_assignable is_copy_assignable]]
|
||||
[def __is_volatile [link boost_typetraits.reference.is_volatile is_volatile]]
|
||||
[def __is_abstract [link boost_typetraits.reference.is_abstract is_abstract]]
|
||||
[def __is_polymorphic [link boost_typetraits.reference.is_polymorphic is_polymorphic]]
|
||||
@ -76,6 +77,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]]
|
||||
@ -261,8 +263,10 @@ See __has_trivial_constructor.
|
||||
[include is_const.qbk]
|
||||
[include is_convertible.qbk]
|
||||
[include is_copy_constructible.qbk]
|
||||
[include is_copy_assignable.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]
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "boost/type_traits/is_const.hpp"
|
||||
#include "boost/type_traits/is_convertible.hpp"
|
||||
#include "boost/type_traits/is_copy_constructible.hpp"
|
||||
#include "boost/type_traits/is_copy_assignable.hpp"
|
||||
#include "boost/type_traits/is_empty.hpp"
|
||||
#include "boost/type_traits/is_enum.hpp"
|
||||
#include "boost/type_traits/is_float.hpp"
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef BOOST_TT_HAS_POST_DECREMENT_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_POST_DECREMENT_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_post_decrement
|
||||
#define BOOST_TT_TRAIT_OP --
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
@ -27,7 +29,9 @@
|
||||
::boost::is_pointer< Lhs_noref >::value\
|
||||
>::value,\
|
||||
::boost::is_const< Lhs_noref >::value\
|
||||
>::value\
|
||||
>::value,\
|
||||
/* Arrays */ \
|
||||
::boost::is_array<Lhs_noref>::value\
|
||||
>::value
|
||||
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_post_increment
|
||||
#define BOOST_TT_TRAIT_OP ++
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
@ -27,7 +29,9 @@
|
||||
::boost::is_pointer< Lhs_noref >::value\
|
||||
>::value,\
|
||||
::boost::is_const< Lhs_noref >::value\
|
||||
>::value\
|
||||
>::value,\
|
||||
/* Arrays */ \
|
||||
::boost::is_array<Lhs_noref>::value\
|
||||
>::value
|
||||
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef BOOST_TT_HAS_PRE_DECREMENT_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_PRE_DECREMENT_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_pre_decrement
|
||||
#define BOOST_TT_TRAIT_OP --
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
@ -27,7 +29,9 @@
|
||||
::boost::is_pointer< Rhs_noref >::value\
|
||||
>::value,\
|
||||
::boost::is_const< Rhs_noref >::value\
|
||||
>::value\
|
||||
>::value,\
|
||||
/* Arrays */ \
|
||||
::boost::is_array<Rhs_noref>::value\
|
||||
>::value
|
||||
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef BOOST_TT_HAS_PRE_INCREMENT_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_PRE_INCREMENT_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_pre_increment
|
||||
#define BOOST_TT_TRAIT_OP ++
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
@ -27,7 +29,9 @@
|
||||
::boost::is_pointer< Rhs_noref >::value\
|
||||
>::value,\
|
||||
::boost::is_const< Rhs_noref >::value\
|
||||
>::value\
|
||||
>::value,\
|
||||
/* Arrays */ \
|
||||
::boost::is_array<Rhs_noref>::value\
|
||||
>::value
|
||||
|
||||
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include <boost/type_traits/detail/ice_or.hpp>
|
||||
#include <boost/type_traits/detail/ice_not.hpp>
|
||||
|
||||
#ifdef __clang__
|
||||
#include <boost/type_traits/is_copy_constructible.hpp>
|
||||
#endif
|
||||
|
||||
// should be the last #include
|
||||
#include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
|
||||
@ -28,7 +32,11 @@ template <typename T>
|
||||
struct has_trivial_copy_impl
|
||||
{
|
||||
#ifdef BOOST_HAS_TRIVIAL_COPY
|
||||
# ifdef __clang__
|
||||
BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) && boost::is_copy_constructible<T>::value);
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T));
|
||||
# endif
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(::boost::type_traits::ice_and<
|
||||
@ -38,6 +46,16 @@ struct has_trivial_copy_impl
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct has_trivial_copy_impl<T[N]>
|
||||
{
|
||||
static const bool value = has_trivial_copy_impl<T>::value;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl<T>::value)
|
||||
|
@ -109,8 +109,8 @@
|
||||
// # define BOOST_ALIGNMENT_OF(T) __alignof(T)
|
||||
|
||||
# if defined(_MSC_VER) && (_MSC_VER >= 1700)
|
||||
# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || ::boost::is_pod<T>::value) && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value)
|
||||
# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || ::boost::is_pod<T>::value) && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value)
|
||||
# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || __is_pod(T)) && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value)
|
||||
# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || __is_pod(T)) && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value)
|
||||
# endif
|
||||
|
||||
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
|
||||
@ -181,8 +181,7 @@
|
||||
# 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)
|
||||
# define BOOST_IS_CONVERTIBLE(T,U) __is_convertible_to(T,U)
|
||||
# endif
|
||||
# if __has_feature(is_enum)
|
||||
# define BOOST_IS_ENUM(T) __is_enum(T)
|
||||
@ -197,6 +196,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
|
||||
@ -235,6 +237,9 @@
|
||||
// old implementation instead in that case:
|
||||
# define BOOST_ALIGNMENT_OF(T) __alignof__(T)
|
||||
# endif
|
||||
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
|
||||
# define BOOST_IS_FINAL(T) __is_final(T)
|
||||
# endif
|
||||
|
||||
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
|
||||
#endif
|
||||
@ -262,7 +267,6 @@
|
||||
# define BOOST_IS_ENUM(T) __is_enum(T)
|
||||
# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
|
||||
# define BOOST_ALIGNMENT_OF(T) __alignof__(T)
|
||||
|
||||
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
|
||||
#endif
|
||||
|
||||
|
147
include/boost/type_traits/is_copy_assignable.hpp
Normal file
147
include/boost/type_traits/is_copy_assignable.hpp
Normal file
@ -0,0 +1,147 @@
|
||||
// (C) Copyright Ion Gaztanaga 2014.
|
||||
//
|
||||
// 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_COPY_ASSIGNABLE_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_CXX11_DECLTYPE) \
|
||||
&& !defined(BOOST_INTEL_CXX_VERSION) && \
|
||||
!(defined(BOOST_MSVC) && _MSC_VER == 1800)
|
||||
#define BOOST_TT_CXX11_IS_COPY_ASSIGNABLE
|
||||
#include <boost/utility/declval.hpp>
|
||||
#else
|
||||
//For compilers without decltype
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
// should be the last #include
|
||||
#include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <bool DerivedFromNoncopyable, class T>
|
||||
struct is_copy_assignable_impl2 {
|
||||
|
||||
// Intel compiler has problems with SFINAE for copy constructors and deleted functions:
|
||||
//
|
||||
// error: function *function_name* cannot be referenced -- it is a deleted function
|
||||
// static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval<T1&>()))* = 0);
|
||||
// ^
|
||||
//
|
||||
// MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See:
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken
|
||||
#if defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE)
|
||||
typedef boost::type_traits::yes_type yes_type;
|
||||
typedef boost::type_traits::no_type no_type;
|
||||
|
||||
template <class U>
|
||||
static decltype(::boost::declval<U&>() = ::boost::declval<const U&>(), yes_type() ) test(int);
|
||||
|
||||
template <class>
|
||||
static no_type test(...);
|
||||
|
||||
static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
|
||||
|
||||
#else
|
||||
static BOOST_DEDUCED_TYPENAME boost::add_reference<T>::type produce();
|
||||
|
||||
template <class T1>
|
||||
static boost::type_traits::no_type test(T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0);
|
||||
|
||||
static boost::type_traits::yes_type test(...);
|
||||
// If you see errors like this:
|
||||
//
|
||||
// `'T::operator=(const T&)' is private`
|
||||
// `boost/type_traits/is_copy_assignable.hpp:NN:M: error: within this context`
|
||||
//
|
||||
// then you are trying to call that macro for a structure defined like that:
|
||||
//
|
||||
// struct T {
|
||||
// ...
|
||||
// private:
|
||||
// T & operator=(const T &);
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// To fix that you must modify your structure:
|
||||
//
|
||||
// // C++03 and C++11 version
|
||||
// struct T: private boost::noncopyable {
|
||||
// ...
|
||||
// private:
|
||||
// T & operator=(const T &);
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// // C++11 version
|
||||
// struct T {
|
||||
// ...
|
||||
// private:
|
||||
// T& operator=(const T &) = delete;
|
||||
// ...
|
||||
// };
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
sizeof(test(produce())) == sizeof(boost::type_traits::yes_type)
|
||||
));
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_copy_assignable_impl2<true, T> {
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_copy_assignable_impl {
|
||||
|
||||
#if !defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE)
|
||||
//For compilers without decltype, at least return false on const types, arrays
|
||||
//types derived from boost::noncopyable and types defined as BOOST_MOVEABLE_BUT_NOT_COPYABLE
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_reference<T>::type unreferenced_t;
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
boost::detail::is_copy_assignable_impl2<
|
||||
boost::is_base_and_derived<boost::noncopyable, T>::value
|
||||
|| boost::is_const<unreferenced_t>::value || boost::is_array<unreferenced_t>::value
|
||||
,T
|
||||
>::value
|
||||
));
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
boost::detail::is_copy_assignable_impl2<
|
||||
boost::is_base_and_derived<boost::noncopyable, T>::value,T
|
||||
>::value
|
||||
));
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_copy_assignable,T,::boost::detail::is_copy_assignable_impl<T>::value)
|
||||
BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void,false)
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void const,false)
|
||||
BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void const volatile,false)
|
||||
BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void volatile,false)
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/type_traits/detail/bool_trait_undef.hpp>
|
||||
|
||||
#endif // BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED
|
@ -32,7 +32,10 @@ struct is_copy_constructible_impl2 {
|
||||
// error: function *function_name* cannot be referenced -- it is a deleted function
|
||||
// static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval<T1&>()))* = 0);
|
||||
// ^
|
||||
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_INTEL_CXX_VERSION)
|
||||
//
|
||||
// MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See:
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken
|
||||
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_INTEL_CXX_VERSION) && !(defined(BOOST_MSVC) && _MSC_VER == 1800)
|
||||
|
||||
#ifdef BOOST_NO_CXX11_DECLTYPE
|
||||
template <class T1>
|
||||
|
41
include/boost/type_traits/is_final.hpp
Normal file
41
include/boost/type_traits/is_final.hpp
Normal 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
|
@ -51,15 +51,6 @@ struct is_nothrow_move_assignable_imp{
|
||||
>::value));
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_NOEXCEPT
|
||||
//
|
||||
// The above logic doesn't quite work in the absense of noexcept,
|
||||
// this is really to improve things with VC13:
|
||||
//
|
||||
template <class T>
|
||||
struct is_nothrow_move_assignable_imp<T&>{ BOOST_STATIC_CONSTANT(bool, value = false); };
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <class T>
|
||||
|
@ -66,15 +66,6 @@ struct is_nothrow_move_constructible_imp{
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_NOEXCEPT
|
||||
//
|
||||
// The above logic doesn't quite work in the absense of noexcept,
|
||||
// this is really to improve things with VC13:
|
||||
//
|
||||
template <class T>
|
||||
struct is_nothrow_move_constructible_imp<T&>{ BOOST_STATIC_CONSTANT(bool, value = false); };
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_nothrow_move_constructible,T,::boost::detail::is_nothrow_move_constructible_imp<T>::value)
|
||||
|
18
meta/libraries.json
Normal file
18
meta/libraries.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"key": "type_traits",
|
||||
"name": "Type Traits",
|
||||
"authors": [
|
||||
"John Maddock, Steve Cleary, et al"
|
||||
],
|
||||
"description": "Templates for fundamental properties of types.",
|
||||
"std": [
|
||||
"tr1"
|
||||
],
|
||||
"category": [
|
||||
"Generic",
|
||||
"Metaprogramming"
|
||||
],
|
||||
"maintainers": [
|
||||
"John Maddock <john -at- johnmaddock.co.uk>"
|
||||
]
|
||||
}
|
@ -12,6 +12,19 @@
|
||||
# include <boost/type_traits/has_trivial_copy.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
|
||||
class bug_10389
|
||||
{
|
||||
int m_data;
|
||||
public:
|
||||
bug_10389() { m_data = 0; }
|
||||
bug_10389(const bug_10389&) = delete;
|
||||
bug_10389(bug_10389&& r) : m_data(r.m_data) { r.m_data = 0; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(has_trivial_copy)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<bool>::value, true);
|
||||
@ -203,6 +216,10 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy<wrap<trivial_except_as
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<test_abc1>::value, false);
|
||||
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<bug_10389>::value, false);
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
223
test/is_copy_assignable.cpp
Normal file
223
test/is_copy_assignable.cpp
Normal file
@ -0,0 +1,223 @@
|
||||
// (C) Copyright John Maddock 2000.
|
||||
// (C) Copyright Ion Gaztanaga 2014.
|
||||
// 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)
|
||||
//#define TEST_STD
|
||||
#include "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_copy_assignable.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#include <boost/move/core.hpp>
|
||||
|
||||
struct has {
|
||||
has(){}
|
||||
has &operator=(const has&){ return *this; }
|
||||
};
|
||||
|
||||
// MSVC can not generate neither default constructor, nor assignment operator,
|
||||
// nor copy constructor for `has2` type. Supressing those warnings is essential,
|
||||
// because we treat warnings as errors in those tests
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4510 4512 4610)
|
||||
#endif
|
||||
struct has2 {
|
||||
int i;
|
||||
has2 &operator=(const int& val) { i = val; return *this; }
|
||||
};
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
||||
struct has3 { // Copy assignment must be generated by compiler
|
||||
has3(has3*){}
|
||||
};
|
||||
|
||||
struct has_not: public boost::noncopyable {
|
||||
typedef boost::noncopyable base_t;
|
||||
has_not() : base_t() {}
|
||||
};
|
||||
|
||||
#if defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE)
|
||||
|
||||
struct has_not2 {
|
||||
has_not2() {}
|
||||
has_not2& operator=(has_not2&) = delete;
|
||||
};
|
||||
|
||||
struct has_not3 {
|
||||
has_not3() {}
|
||||
has_not3& operator=(const has_not3&) = delete;
|
||||
};
|
||||
|
||||
#endif // BOOST_TT_CXX11_IS_COPY_ASSIGNABLE
|
||||
|
||||
struct has_not4: private boost::noncopyable {
|
||||
typedef boost::noncopyable base_t;
|
||||
has_not4() : base_t() {}
|
||||
private:
|
||||
has_not4& operator=(const has_not4&);
|
||||
};
|
||||
|
||||
struct has_not5 {
|
||||
private:
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(has_not5)
|
||||
};
|
||||
|
||||
struct has_not6 {
|
||||
has_not6& operator=(has_not6&){ return *this; }
|
||||
};
|
||||
|
||||
|
||||
TT_TEST_BEGIN(is_copy_assignable)
|
||||
|
||||
// Main part of the test
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has3>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has_not>::value, false);
|
||||
#if defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE)
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has_not2>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has_not3>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has_not6>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has_not4>::value, false);
|
||||
|
||||
// Requires some basic support from Boost.Move in C++03
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<has_not5>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<bool>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<bool const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<bool volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<bool const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<signed char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<signed char const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<signed char volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<signed char const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned char const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<char const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned char volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned char const volatile>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<char volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<char const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned short const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<short const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned short volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned short const volatile>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<short volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<short const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned int const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned int volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned int const volatile>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned long const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned long volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<unsigned long const volatile>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long const volatile>::value, false);
|
||||
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::ulong_long_type>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::ulong_long_type const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::long_long_type>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::long_long_type const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::ulong_long_type volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::ulong_long_type const volatile>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::long_long_type volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable< ::boost::long_long_type const volatile>::value, false);
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<float>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<float const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<float volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<float const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<double const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<double const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long double const>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<long double const volatile>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<void*>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int*const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<f1>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<f2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<f3>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<mf1>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<mf2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<mf3>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<mp>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<cmf>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<enum_UDT>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int&>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<const int&>::value, false);
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int&&>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<const int&&>::value, false);
|
||||
#endif
|
||||
|
||||
// Following three tests may give different results because of compiler and C++03/C++11.
|
||||
// On C++11 compiler following code:
|
||||
// int c[2][4][5][6][3];
|
||||
// int b[2][4][5][6][3] = std::move(c);
|
||||
// does not compile, so we expect `false` to be the result of those three tests.
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int[2]>::value, false, true);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int[3][2]>::value, false, true);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_copy_assignable<int[2][4][5][6][3]>::value, false, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<void>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<empty_POD_UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<POD_UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<POD_union_UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<empty_POD_union_UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<nothrow_copy_UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<nothrow_assign_UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_assignable<nothrow_construct_UDT>::value, true);
|
||||
|
||||
|
||||
TT_TEST_END
|
||||
|
80
test/is_final_test.cpp
Normal file
80
test/is_final_test.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
// 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_NO_CXX11_FINAL)
|
||||
//
|
||||
// These are "soft" checks: since we cannot implement this trait
|
||||
// ourselves and instead rely on the compiler.
|
||||
//
|
||||
# ifndef BOOST_IS_FINAL
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_final<final_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_final<final_UDT const>::value, true, false);
|
||||
# else
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<final_UDT>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final<final_UDT const>::value, true);
|
||||
# endif
|
||||
#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);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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 { };
|
||||
|
Reference in New Issue
Block a user