Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/doc/refmanual/at-c.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 8.1 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" />
7<title>The MPL Reference Manual: at_c</title>
8<link rel="stylesheet" href="../style.css" type="text/css" />
9</head>
10<body class="docframe refmanual">
11<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./at.html" class="navigation-link">Prev</a>&nbsp;<a href="./back.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./at.html" class="navigation-link">Back</a>&nbsp;<a href="./back.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./intrinsic-metafunctions.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
12<td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./sequences.html" class="navigation-link">Sequences</a> / <a href="./intrinsic-metafunctions.html" class="navigation-link">Intrinsic Metafunctions</a> / <a href="./at-c.html" class="navigation-link">at_c</a></td>
13</tr></table><div class="header-separator"></div>
14<div class="section" id="at-c">
15<h1><a class="toc-backref" href="./intrinsic-metafunctions.html#id354" name="at-c">at_c</a></h1>
16<div class="section" id="intrinsic-at-synopsis">
17<h3><a class="subsection-title" href="#synopsis" name="synopsis">Synopsis</a></h3>
18<pre class="literal-block">
19template&lt;
20      typename Sequence
21    , long n
22    &gt;
23struct <a href="./at-c.html" class="identifier">at_c</a>
24{
25    typedef <em>unspecified</em> type;
26};
27</pre>
28</div>
29<div class="section" id="intrinsic-at-description">
30<h3><a class="subsection-title" href="#description" name="description">Description</a></h3>
31<p>Returns a type identical to the <tt class="literal"><span class="pre">n</span></tt>th element from the beginning of
32the sequence. <tt class="literal"><span class="pre"><a href="./at-c.html" class="identifier">at_c</a>&lt;Sequence,n&gt;::type</span></tt> is a shorcut notation for
33<tt class="literal"><span class="pre"><a href="./at.html" class="identifier">at</a>&lt;</span> <span class="pre">Sequence,</span> <span class="pre"><a href="./long.html" class="identifier">long_</a>&lt;n&gt;</span> <span class="pre">&gt;::type</span></tt>.</p>
34</div>
35<div class="section" id="intrinsic-at-header">
36<h3><a class="subsection-title" href="#header" name="header">Header</a></h3>
37<pre class="literal-block">
38#include &lt;<a href="../../../../boost/mpl/at.hpp" class="header">boost/mpl/at.hpp</a>&gt;
39</pre>
40</div>
41<div class="section" id="intrinsic-at-parameters">
42<h3><a class="subsection-title" href="#parameters" name="parameters">Parameters</a></h3>
43<table border="1" class="table">
44<colgroup>
45<col width="15%" />
46<col width="36%" />
47<col width="48%" />
48</colgroup>
49<thead valign="bottom">
50<tr><th>Parameter</th>
51<th>Requirement</th>
52<th>Description</th>
53</tr>
54</thead>
55<tbody valign="top">
56<tr><td><tt class="literal"><span class="pre">Sequence</span></tt></td>
57<td><a class="reference" href="./forward-sequence.html">Forward Sequence</a></td>
58<td>A sequence to be examined.</td>
59</tr>
60<tr><td><tt class="literal"><span class="pre">n</span></tt></td>
61<td>A compile-time integral constant</td>
62<td>An offset from the beginning of the sequence
63specifying the element to be retrieved.</td>
64</tr>
65</tbody>
66</table>
67</div>
68<div class="section" id="intrinsic-at-expression-semantics">
69<h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3>
70<pre class="literal-block">
71typedef <a href="./at-c.html" class="identifier">at_c</a>&lt;Sequence,n&gt;::type t;
72</pre>
73<table class="field-list" frame="void" rules="none">
74<col class="field-name" />
75<col class="field-body" />
76<tbody valign="top">
77<tr class="field"><th class="field-name">Return type:</th><td class="field-body">A type</td>
78</tr>
79<tr class="field"><th class="field-name">Precondition:</th><td class="field-body"><tt class="literal"><span class="pre">0</span> <span class="pre">&lt;=</span> <span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre"><a href="./size.html" class="identifier">size</a>&lt;Sequence&gt;::value</span></tt></td>
80</tr>
81<tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><p class="first">Equivalent to</p>
82<pre class="last literal-block">
83typedef <a href="./at.html" class="identifier">at</a>&lt; Sequence, <a href="./long.html" class="identifier">long_</a>&lt;n&gt; &gt;::type t;
84</pre>
85</td>
86</tr>
87</tbody>
88</table>
89</div>
90<div class="section" id="at-complexity">
91<h3><a class="subsection-title" href="#complexity" name="complexity">Complexity</a></h3>
92<table border="1" class="table">
93<colgroup>
94<col width="47%" />
95<col width="53%" />
96</colgroup>
97<thead valign="bottom">
98<tr><th>Sequence archetype</th>
99<th>Complexity</th>
100</tr>
101</thead>
102<tbody valign="top">
103<tr><td><a class="reference" href="./forward-sequence.html">Forward Sequence</a></td>
104<td>Linear.</td>
105</tr>
106<tr><td><a class="reference" href="./random-access-sequence.html">Random Access Sequence</a></td>
107<td>Amortized constant time.</td>
108</tr>
109</tbody>
110</table>
111</div>
112<div class="section" id="intrinsic-at-example">
113<h3><a class="subsection-title" href="#example" name="example">Example</a></h3>
114<pre class="literal-block">
115typedef <a href="./range-c.html" class="identifier">range_c</a>&lt;long,10,50&gt; range;
116<a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( (<a href="./at-c.html" class="identifier">at_c</a>&lt; range,0 &gt;::value), ==, 10 );
117<a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( (<a href="./at-c.html" class="identifier">at_c</a>&lt; range,10 &gt;::value), ==, 20 );
118<a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( (<a href="./at-c.html" class="identifier">at_c</a>&lt; range,40 &gt;::value), ==, 50 );
119</pre>
120</div>
121<div class="section" id="intrinsic-at-see-also">
122<h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3>
123<p><a class="reference" href="./forward-sequence.html">Forward Sequence</a>, <a class="reference" href="./random-access-sequence.html">Random Access Sequence</a>, <a class="refentry reference" href="./at.html"><tt class="refentry literal"><span class="pre">at</span></tt></a>, <a class="refentry reference" href="./front.html"><tt class="refentry literal"><span class="pre">front</span></tt></a>, <a class="refentry reference" href="./back.html"><tt class="refentry literal"><span class="pre">back</span></tt></a></p>
124<!-- modtime: November 13, 2004 01:23:57 +0000 -->
125<!-- Sequences/Intrinsic Metafunctions//back -->
126</div>
127</div>
128
129<div class="footer-separator"></div>
130<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./at.html" class="navigation-link">Prev</a>&nbsp;<a href="./back.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./at.html" class="navigation-link">Back</a>&nbsp;<a href="./back.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./intrinsic-metafunctions.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
131</tr></table></body>
132</html>
Note: See TracBrowser for help on using the repository browser.