Files
mpl/doc/ref/Reference/clear.html
Dave Abrahams 01d61922bc Added libs/mpl
[SVN r15384]
2002-09-16 19:25:33 +00:00

60 lines
2.4 KiB
HTML

<!doctype html public "-//ietf//dtd html//en">
<html><head><title>boost::mpl::Reference/clear</title>
<link rel="stylesheet" href="../mpl_wiki.css">
</head><body bgcolor="white">
<h1><a href="../Table_of_Content.html"><img src="../mpl_logo.jpg" alt="[Home]" border=0 align="right"></a>clear</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
typename Sequence
&gt;
struct clear
{
typedef <em>unspecified</em> type;
};
</pre>
<p>
<h3>Description</h3>
<p>
Returns an empty sequence that preserves all the functional and performance characteristics of the original <code>Sequence</code>, except its size and identity.
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../\boost/mpl/clear.hpp">boost/mpl/clear.hpp</a>"
</pre>
<p>
<h3>Parameters</h3>
<table border="1">
<tr><th>&nbsp;Parameter&nbsp;</th><th>&nbsp;Requirement&nbsp;</th><th>&nbsp;Description &nbsp;</th></tr>
<tr><td><code>Sequence</code></td><td>A model of <a href="../Extensible_Sequence.html">Extensible Sequence</a></td><td></td></tr>
</table>
<p>
<h3>Expression semantics</h3>
<p>
<table border="1">
<tr><th>&nbsp;Expression&nbsp;</th><th>&nbsp;Expression&nbsp;type&nbsp;</th><th>&nbsp;Precondition&nbsp;</th><th>&nbsp;Semantics&nbsp;</th><th>&nbsp;Postcondition&nbsp;</th></tr>
<tr><td><code>typedef clear&lt;Sequence&gt;::type s;</code></td><td>A model of <a href="../Extensible_Sequence.html">Extensible Sequence</a></td><td></td><td>Equivalent to <code>typedef erase&lt;Sequence, begin&lt;Sequence&gt;::type, end&lt;Sequence&gt;::type&gt;::type s;</code></td><td><code>empty&lt;s&gt;::type::value == true</code> </td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
Amortized constant time [<a href="#1">1</a>].
<p>
<h3>Example</h3>
<p>
<pre>
typedef list_c&lt;int,1,3,5,7,9,11&gt; odds;
typedef clear&lt;odds&gt;::type nothing;
BOOST_STATIC_ASSERT(empty&lt;nothing&gt;::type::value);
</pre>
<p>
<h3>Notes</h3>
<p>
[<a name="1">1</a>] The algorithm is provided only if the sequence can meet the stated complexity requirements.<br>
<p>
<h3>See also</h3>
<p>
<a href="../Extensible_Sequence.html">Extensible Sequence</a>, <code><a href="../Reference/erase.html">erase</a></code>, <code><a href="../Reference/empty.html">empty</a></code>, <code><a href="../Reference/begin.html">begin</a></code>, <code><a href="../Reference/end.html">end</a></code>
<p><hr>
<a href="../Table_of_Content.html">Table of Content</a> | <a href="../Reference.html">Reference</a><br>Last edited July 17, 2002 3:58 am</body></html>