mirror of
https://github.com/boostorg/mpl.git
synced 2026-01-26 17:02:20 +01:00
59 lines
2.6 KiB
HTML
59 lines
2.6 KiB
HTML
<!doctype html public "-//ietf//dtd html//en">
|
|
<html><head><title>boost::mpl::Reference/at</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>at</h1><h3>Synopsis</h3>
|
|
<p>
|
|
<pre>
|
|
template<
|
|
typename N
|
|
, typename Sequence
|
|
>
|
|
struct at
|
|
{
|
|
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.
|
|
<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> Parameter </th><th> Requirement </th><th> Description </th></tr>
|
|
<tr><td><code>N</code></td><td>A model of <a href="../Integral_Constant.html">Integral Constant</a></td><td>The offset from the beginning of the sequence that specifies the element to be retrieved. </td></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> Expression </th><th> Expression type </th><th> Precondition </th><th> Semantics </th><th> Postcondition </th></tr>
|
|
<tr><td><code>typedef at<N,Sequence>::type t;</code></td><td>A type</td><td><code>0 <= N::value < size<Sequence>::type::value</code></td><td>Equivalent to <code>typedef advance< begin<Sequence>::type,N >::type::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><long,10,50> range;
|
|
BOOST_STATIC_ASSERT(at< int_c<0>, range >::type::value == 10);
|
|
BOOST_STATIC_ASSERT(at< int_c<10>, range >::type::value == 20);
|
|
BOOST_STATIC_ASSERT(at< int_c<40>, range >::type::value == 50);
|
|
</pre>
|
|
<p>
|
|
<h3>See also</h3>
|
|
<p>
|
|
<a href="../Forward_Sequence.html">Forward Sequence</a>, <code><a href="../Reference/at_c.html">at_c</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_Content.html">Table of Content</a> | <a href="../Reference.html">Reference</a><br>Last edited July 17, 2002 3:49 am</body></html> |