Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > ef9bad9e14fc2a68cb7c992c11d75f5e > files > 3085

libboost1-devel-1.31.0-1mdk.i586.rpm

<!doctype html public "-//ietf//dtd html//en">
<html><head><title>boost::mpl::single_view</title>
<link rel="stylesheet" href="../mpl_wiki.css">
</head><body bgcolor="white">
<h1><a href="../Table_of_Contents.html"><img src="../mpl_logo.jpg" alt="[Home]" border=0 align="right"></a>single_view</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
      typename T
    &gt;
struct single_view
{
    <span class="cxx-comment">// unspecified</span>
};
</pre>
<p>
<h3>Description</h3>
<p>
Allows one to represent an arbitrary type <code>T</code> as a single-element sequence. 
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../boost/mpl/single_view.hpp">boost/mpl/single_view.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>T</code></td><td>A type</td><td>The type to be wrapped in a sequence. </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 single_view&lt;T&gt; s;</code></td><td>A model of <a href="../Sequence.html">Sequence</a></td><td></td><td><code>s</code> is a random-access, single-element sequence such as <code><a href="../Reference/front.html">front</a>&lt;s&gt;::type</code> is identical to <code>T</code></td><td><code><a href="../Reference/size.html">size</a>&lt;s&gt;::type::value == 1, boost::same_as&lt;<a href="../Reference/front.html">front</a>&lt;s&gt;::type,T&gt;::value == true</code>. </td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
Amortized constant time.
<p>
<h3>Example</h3>
<p>
<pre>
typedef single_view&lt;int&gt; view;
typedef <a href="../Reference/begin.html">begin</a>&lt;view&gt;::type first;
typedef <a href="../Reference/end.html">end</a>&lt;view&gt;::type last;
<p>
BOOST_MPL_ASSERT_IS_SAME(first::type,int);
BOOST_MPL_ASSERT_IS_SAME(first::next,last);
BOOST_MPL_ASSERT_IS_SAME(last::prior,first);
<p>
BOOST_STATIC_ASSERT(size&lt;view&gt;::type::value == 1);
</pre>
<p>
<h3>See also</h3>
<p>
<a href="../Sequences.html">Sequences</a>, <code><a href="../Reference/transform_view.html">transform_view</a></code>, <code><a href="../Reference/filter_view.html">filter_view</a></code>, <code><a href="../Reference/joint_view.html">joint_view</a></code>, <code><a href="../Reference/zip_view.html">zip_view</a></code>
<p><hr>
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited March 10, 2003 5:19 am</body></html>