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