Sophie

Sophie

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

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

<!doctype html public "-//ietf//dtd html//en">
<html><head><title>boost::mpl::at_c</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>at_c</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
      typename Sequence
    , long n
    &gt;
struct at_c
{
    typedef <em>unspecified</em> type;
};
</pre>
<p>
<h3>Description</h3>
<p>
Returns a type identical to the <code>n</code>-th element from the beginning of the sequence. <code>at_c&lt;Sequence,n&gt;::type</code> is a shorcut notation for <code>at&lt; Sequence, integral_c&lt;long,n&gt; &gt;::type</code>.
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../boost/mpl/at.hpp">boost/mpl/at.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 being examined. </td></tr>
<tr><td><code>n</code></td><td>An compile-time integral constant</td><td>An offset from the beginning of the sequence that specifies the element to be retrieved. </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 at_c&lt;Sequence,n&gt;::type t;</code></td><td>A type</td><td><code>0 &lt;= n &lt; size&lt;Sequence&gt;::type::value</code></td><td>Equivalent to <code>typedef at&lt; Sequence, integral_c&lt;long,n&gt; &gt;::type t;</code></td><td></td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
Depends on the implementation of the particular sequence it is applied to. Linear in the worst case, or amortized constant time.
<p>
<h3>Example</h3>
<p>
<pre>
typedef <a href="../Reference/range_c.html">range_c</a>&lt;long,10,50&gt; range;
BOOST_STATIC_ASSERT(at_c&lt;range,0&gt;::type::value == 10);
BOOST_STATIC_ASSERT(at_c&lt;range,10&gt;::type::value == 20);
BOOST_STATIC_ASSERT(at_c&lt;range,40&gt;::type::value == 50);
</pre>
<p>
<h3>See also</h3>
<p>
<a href="../Forward_Sequence.html">Forward Sequence</a>, <code><a href="../Reference/at.html">at</a></code>, <code><a href="../Reference/front.html">front</a></code>, <code><a href="../Reference/back.html">back</a></code>
<p><hr>
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited October 21, 2002 4:09 am</body></html>