Files
mpl/doc/ref/Reference/front.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/front</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>front</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
typename Sequence
&gt;
struct front
{
typedef <em>unspecified</em> type;
};
</pre>
<p>
<h3>Description</h3>
<p>
Returns a type identical to the first element in the sequence.
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../\boost/mpl/front.hpp">boost/mpl/front.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="../Forward_Sequence.html">Forward Sequence</a></td><td>A sequence to be examined. </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 front&lt;Sequence&gt;::type t;</code></td><td>A type</td><td><code>empty&lt;Sequence&gt;::type::value == false</code></td><td>Equivalent to <code>typedef begin&lt;Sequence&gt;::type::type t;</code></td><td></td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
Amortized constant time.
<p>
<h3>Example</h3>
<p>
<pre>
typedef <a href="../Reference/list.html">list</a>&lt;long&gt;::type types1;
typedef list&lt;int,long&gt;::type types2;
typedef list&lt;char,int,long&gt;::type types3;
<p>
BOOST_MPL_ASSERT_IS_SAME(front&lt;types1&gt;::type, long);
BOOST_MPL_ASSERT_IS_SAME(front&lt;types2&gt;::type, int);
BOOST_MPL_ASSERT_IS_SAME(front&lt;types3&gt;::type, char);
</pre>
<p>
<h3>See also</h3>
<p>
<a href="../Forward_Sequence.html">Forward Sequence</a>, <code><a href="../Reference/back.html">back</a></code>, <code><a href="../Reference/at.html">at</a></code>, <code><a href="../Reference/push_front.html">push_front</a></code>, <code><a href="../Reference/begin.html">begin</a></code>, <code><a href="../Reference/empty.html">empty</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:48 am</body></html>