• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>advance_c</title>
5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Chapter 1. Fusion 2.2">
8<link rel="up" href="../functions.html" title="Functions">
9<link rel="prev" href="advance.html" title="advance">
10<link rel="next" href="deref_data.html" title="deref_data">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="advance.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="deref_data.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="fusion.iterator.functions.advance_c"></a><a class="link" href="advance_c.html" title="advance_c">advance_c</a>
28</h4></div></div></div>
29<h6>
30<a name="fusion.iterator.functions.advance_c.h0"></a>
31          <span class="phrase"><a name="fusion.iterator.functions.advance_c.description"></a></span><a class="link" href="advance_c.html#fusion.iterator.functions.advance_c.description">Description</a>
32        </h6>
33<p>
34          Moves an iterator by a specified distance.
35        </p>
36<h6>
37<a name="fusion.iterator.functions.advance_c.h1"></a>
38          <span class="phrase"><a name="fusion.iterator.functions.advance_c.synopsis"></a></span><a class="link" href="advance_c.html#fusion.iterator.functions.advance_c.synopsis">Synopsis</a>
39        </h6>
40<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
41    <span class="keyword">int</span> <span class="identifier">N</span><span class="special">,</span>
42    <span class="keyword">typename</span> <span class="identifier">I</span>
43    <span class="special">&gt;</span>
44<span class="keyword">typename</span> <a class="link" href="../metafunctions/advance_c.html" title="advance_c"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">advance_c</span></code></a><span class="special">&lt;</span><span class="identifier">I</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">advance_c</span><span class="special">(</span><span class="identifier">I</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">i</span><span class="special">);</span>
45</pre>
46<div class="table">
47<a name="fusion.iterator.functions.advance_c.t0"></a><p class="title"><b>Table 1.6. Parameters</b></p>
48<div class="table-contents"><table class="table" summary="Parameters">
49<colgroup>
50<col>
51<col>
52<col>
53</colgroup>
54<thead><tr>
55<th>
56                  <p>
57                    Parameter
58                  </p>
59                </th>
60<th>
61                  <p>
62                    Requirement
63                  </p>
64                </th>
65<th>
66                  <p>
67                    Description
68                  </p>
69                </th>
70</tr></thead>
71<tbody>
72<tr>
73<td>
74                  <p>
75                    <code class="computeroutput"><span class="identifier">i</span></code>
76                  </p>
77                </td>
78<td>
79                  <p>
80                    Model of <a class="link" href="../concepts/forward_iterator.html" title="Forward Iterator">Forward
81                    Iterator</a>
82                  </p>
83                </td>
84<td>
85                  <p>
86                    Iterator to move relative to
87                  </p>
88                </td>
89</tr>
90<tr>
91<td>
92                  <p>
93                    <code class="computeroutput"><span class="identifier">N</span></code>
94                  </p>
95                </td>
96<td>
97                  <p>
98                    Integer constant
99                  </p>
100                </td>
101<td>
102                  <p>
103                    Number of positions to move
104                  </p>
105                </td>
106</tr>
107</tbody>
108</table></div>
109</div>
110<br class="table-break"><h6>
111<a name="fusion.iterator.functions.advance_c.h2"></a>
112          <span class="phrase"><a name="fusion.iterator.functions.advance_c.expression_semantics"></a></span><a class="link" href="advance_c.html#fusion.iterator.functions.advance_c.expression_semantics">Expression
113          Semantics</a>
114        </h6>
115<pre class="programlisting"><a class="link" href="advance_c.html" title="advance_c"><code class="computeroutput"><span class="identifier">advance_c</span></code></a><span class="special">&lt;</span><span class="identifier">N</span><span class="special">&gt;(</span><span class="identifier">i</span><span class="special">);</span>
116</pre>
117<p>
118          <span class="bold"><strong>Return type</strong></span>: A model of the same iterator
119          concept as <code class="computeroutput"><span class="identifier">i</span></code>.
120        </p>
121<p>
122          <span class="bold"><strong>Semantics</strong></span>: Returns an iterator to the
123          element <code class="computeroutput"><span class="identifier">N</span></code> positions from
124          <code class="computeroutput"><span class="identifier">i</span></code>. If <code class="computeroutput"><span class="identifier">i</span></code>
125          is a <a class="link" href="../concepts/bidirectional_iterator.html" title="Bidirectional Iterator">Bidirectional
126          Iterator</a> then <code class="computeroutput"><span class="identifier">N</span></code>
127          may be negative.
128        </p>
129<h6>
130<a name="fusion.iterator.functions.advance_c.h3"></a>
131          <span class="phrase"><a name="fusion.iterator.functions.advance_c.header"></a></span><a class="link" href="advance_c.html#fusion.iterator.functions.advance_c.header">Header</a>
132        </h6>
133<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">iterator</span><span class="special">/</span><span class="identifier">advance</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
134<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">advance</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
135</pre>
136<h6>
137<a name="fusion.iterator.functions.advance_c.h4"></a>
138          <span class="phrase"><a name="fusion.iterator.functions.advance_c.example"></a></span><a class="link" href="advance_c.html#fusion.iterator.functions.advance_c.example">Example</a>
139        </h6>
140<pre class="programlisting"><span class="keyword">typedef</span> <a class="link" href="../../container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span><span class="keyword">int</span><span class="special">,</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">vec</span><span class="special">;</span>
141
142<span class="identifier">vec</span> <span class="identifier">v</span><span class="special">(</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">3</span><span class="special">);</span>
143<span class="identifier">assert</span><span class="special">(</span><a class="link" href="deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a><span class="special">(</span><a class="link" href="advance_c.html" title="advance_c"><code class="computeroutput"><span class="identifier">advance_c</span></code></a><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;(</span><a class="link" href="../../sequence/intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">v</span><span class="special">)))</span> <span class="special">==</span> <span class="number">3</span><span class="special">);</span>
144</pre>
145</div>
146<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
147<td align="left"></td>
148<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
149      Dan Marsden, Tobias Schwinger<p>
150        Distributed under the Boost Software License, Version 1.0. (See accompanying
151        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
152      </p>
153</div></td>
154</tr></table>
155<hr>
156<div class="spirit-nav">
157<a accesskey="p" href="advance.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="deref_data.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
158</div>
159</body>
160</html>
161