1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>advance</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="../metafunctions.html" title="Metafunctions"> 9<link rel="prev" href="distance.html" title="distance"> 10<link rel="next" href="advance_c.html" title="advance_c"> 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="distance.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../metafunctions.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="advance_c.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.metafunctions.advance"></a><a class="link" href="advance.html" title="advance">advance</a> 28</h4></div></div></div> 29<h6> 30<a name="fusion.iterator.metafunctions.advance.h0"></a> 31 <span class="phrase"><a name="fusion.iterator.metafunctions.advance.description"></a></span><a class="link" href="advance.html#fusion.iterator.metafunctions.advance.description">Description</a> 32 </h6> 33<p> 34 Moves an iterator a specified distance. 35 </p> 36<h6> 37<a name="fusion.iterator.metafunctions.advance.h1"></a> 38 <span class="phrase"><a name="fusion.iterator.metafunctions.advance.synopsis"></a></span><a class="link" href="advance.html#fusion.iterator.metafunctions.advance.synopsis">Synopsis</a> 39 </h6> 40<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> 41 <span class="keyword">typename</span> <span class="identifier">I</span><span class="special">,</span> 42 <span class="keyword">typename</span> <span class="identifier">M</span> 43 <span class="special">></span> 44<span class="keyword">struct</span> <span class="identifier">advance</span> 45<span class="special">{</span> 46 <span class="keyword">typedef</span> <span class="emphasis"><em>unspecified</em></span> <span class="identifier">type</span><span class="special">;</span> 47<span class="special">};</span> 48</pre> 49<div class="table"> 50<a name="fusion.iterator.metafunctions.advance.t0"></a><p class="title"><b>Table 1.17. Parameters</b></p> 51<div class="table-contents"><table class="table" summary="Parameters"> 52<colgroup> 53<col> 54<col> 55<col> 56</colgroup> 57<thead><tr> 58<th> 59 <p> 60 Parameter 61 </p> 62 </th> 63<th> 64 <p> 65 Requirement 66 </p> 67 </th> 68<th> 69 <p> 70 Description 71 </p> 72 </th> 73</tr></thead> 74<tbody> 75<tr> 76<td> 77 <p> 78 <code class="computeroutput"><span class="identifier">I</span></code> 79 </p> 80 </td> 81<td> 82 <p> 83 Model of <a class="link" href="../concepts/forward_iterator.html" title="Forward Iterator">Forward 84 Iterator</a> 85 </p> 86 </td> 87<td> 88 <p> 89 Iterator to move relative to 90 </p> 91 </td> 92</tr> 93<tr> 94<td> 95 <p> 96 <code class="computeroutput"><span class="identifier">M</span></code> 97 </p> 98 </td> 99<td> 100 <p> 101 Model of <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL 102 Integral Constant</a> 103 </p> 104 </td> 105<td> 106 <p> 107 Number of positions to move 108 </p> 109 </td> 110</tr> 111</tbody> 112</table></div> 113</div> 114<br class="table-break"><h6> 115<a name="fusion.iterator.metafunctions.advance.h2"></a> 116 <span class="phrase"><a name="fusion.iterator.metafunctions.advance.expression_semantics"></a></span><a class="link" href="advance.html#fusion.iterator.metafunctions.advance.expression_semantics">Expression 117 Semantics</a> 118 </h6> 119<pre class="programlisting"><a class="link" href="advance.html" title="advance"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">advance</span></code></a><span class="special"><</span><span class="identifier">I</span><span class="special">,</span><span class="identifier">M</span><span class="special">>::</span><span class="identifier">type</span> 120</pre> 121<p> 122 <span class="bold"><strong>Return type</strong></span>: A model of the same iterator 123 concept as <code class="computeroutput"><span class="identifier">I</span></code>. 124 </p> 125<p> 126 <span class="bold"><strong>Semantics</strong></span>: Returns an iterator a distance 127 <code class="computeroutput"><span class="identifier">M</span></code> from <code class="computeroutput"><span class="identifier">I</span></code>. 128 If <code class="computeroutput"><span class="identifier">I</span></code> is a <a class="link" href="../concepts/bidirectional_iterator.html" title="Bidirectional Iterator">Bidirectional 129 Iterator</a> then <code class="computeroutput"><span class="identifier">M</span></code> 130 may be negative. 131 </p> 132<h6> 133<a name="fusion.iterator.metafunctions.advance.h3"></a> 134 <span class="phrase"><a name="fusion.iterator.metafunctions.advance.header"></a></span><a class="link" href="advance.html#fusion.iterator.metafunctions.advance.header">Header</a> 135 </h6> 136<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</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">></span> 137<span class="preprocessor">#include</span> <span class="special"><</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">></span> 138</pre> 139<h6> 140<a name="fusion.iterator.metafunctions.advance.h4"></a> 141 <span class="phrase"><a name="fusion.iterator.metafunctions.advance.example"></a></span><a class="link" href="advance.html#fusion.iterator.metafunctions.advance.example">Example</a> 142 </h6> 143<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"><</span><span class="keyword">int</span><span class="special">,</span><span class="keyword">double</span><span class="special">,</span><span class="keyword">char</span><span class="special">></span> <span class="identifier">vec</span><span class="special">;</span> 144<span class="keyword">typedef</span> <a class="link" href="../../sequence/intrinsic/metafunctions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin</span></code></a><span class="special"><</span><span class="identifier">vec</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">first</span><span class="special">;</span> 145<span class="keyword">typedef</span> <a class="link" href="next.html" title="next"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">next</span></code></a><span class="special"><</span><span class="identifier">first</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">second</span><span class="special">;</span> 146<span class="keyword">typedef</span> <a class="link" href="next.html" title="next"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">next</span></code></a><span class="special"><</span><span class="identifier">second</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">third</span><span class="special">;</span> 147 148<span class="identifier">BOOST_MPL_ASSERT</span><span class="special">((</span><a class="link" href="equal_to.html" title="equal_to"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">equal_to</span></code></a><span class="special"><</span><a class="link" href="advance.html" title="advance"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">advance</span></code></a><span class="special"><</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special"><</span><span class="number">2</span><span class="special">></span> <span class="special">>::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">third</span><span class="special">>));</span> 149</pre> 150</div> 151<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 152<td align="left"></td> 153<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman, 154 Dan Marsden, Tobias Schwinger<p> 155 Distributed under the Boost Software License, Version 1.0. (See accompanying 156 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>) 157 </p> 158</div></td> 159</tr></table> 160<hr> 161<div class="spirit-nav"> 162<a accesskey="p" href="distance.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../metafunctions.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="advance_c.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 163</div> 164</body> 165</html> 166