• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>iota</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. Range 2.0">
8<link rel="up" href="../new.html" title="New algorithms">
9<link rel="prev" href="insert.html" title="insert">
10<link rel="next" href="is_sorted.html" title="is_sorted">
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="insert.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../new.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="is_sorted.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="range.reference.algorithms.new.iota"></a><a class="link" href="iota.html" title="iota">iota</a>
28</h5></div></div></div>
29<h6>
30<a name="range.reference.algorithms.new.iota.h0"></a>
31            <span class="phrase"><a name="range.reference.algorithms.new.iota.prototype"></a></span><a class="link" href="iota.html#range.reference.algorithms.new.iota.prototype">Prototype</a>
32          </h6>
33<p>
34</p>
35<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">ForwardRange</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Value</span><span class="special">&gt;</span>
36<span class="identifier">ForwardRange</span><span class="special">&amp;</span> <span class="identifier">iota</span><span class="special">(</span><span class="identifier">ForwardRange</span><span class="special">&amp;</span> <span class="identifier">rng</span><span class="special">,</span> <span class="identifier">Value</span> <span class="identifier">x</span><span class="special">);</span>
37</pre>
38<p>
39          </p>
40<h6>
41<a name="range.reference.algorithms.new.iota.h1"></a>
42            <span class="phrase"><a name="range.reference.algorithms.new.iota.description"></a></span><a class="link" href="iota.html#range.reference.algorithms.new.iota.description">Description</a>
43          </h6>
44<p>
45            <code class="computeroutput"><span class="identifier">iota</span></code> traverses forward
46            through <code class="computeroutput"><span class="identifier">rng</span></code>, each element
47            <code class="computeroutput"><span class="identifier">y</span></code> in <code class="computeroutput"><span class="identifier">rng</span></code>
48            is assigned a value equivalent to <code class="computeroutput"><span class="identifier">x</span>
49            <span class="special">+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">rng</span><span class="special">),</span> <span class="identifier">it</span><span class="special">)</span></code>
50          </p>
51<h6>
52<a name="range.reference.algorithms.new.iota.h2"></a>
53            <span class="phrase"><a name="range.reference.algorithms.new.iota.definition"></a></span><a class="link" href="iota.html#range.reference.algorithms.new.iota.definition">Definition</a>
54          </h6>
55<p>
56            Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">algorithm_ext</span><span class="special">/</span><span class="identifier">iota</span><span class="special">.</span><span class="identifier">hpp</span></code>
57          </p>
58<h6>
59<a name="range.reference.algorithms.new.iota.h3"></a>
60            <span class="phrase"><a name="range.reference.algorithms.new.iota.requirements"></a></span><a class="link" href="iota.html#range.reference.algorithms.new.iota.requirements">Requirements</a>
61          </h6>
62<div class="orderedlist"><ol class="orderedlist" type="1">
63<li class="listitem">
64                <code class="computeroutput"><span class="identifier">ForwardRange</span></code> is a
65                model of the <a class="link" href="../../../concepts/forward_range.html" title="Forward Range">Forward
66                Range</a> Concept.
67              </li>
68<li class="listitem">
69                <code class="computeroutput"><span class="identifier">Value</span></code> is a model
70                of the <code class="computeroutput"><span class="identifier">Incrementable</span></code>
71                Concept.
72              </li>
73</ol></div>
74<h6>
75<a name="range.reference.algorithms.new.iota.h4"></a>
76            <span class="phrase"><a name="range.reference.algorithms.new.iota.complexity"></a></span><a class="link" href="iota.html#range.reference.algorithms.new.iota.complexity">Complexity</a>
77          </h6>
78<p>
79            Linear. Exactly <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)</span></code> assignments into <code class="computeroutput"><span class="identifier">rng</span></code>.
80          </p>
81</div>
82<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
83<td align="left"></td>
84<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
85      Neil Groves<p>
86        Distributed under the Boost Software License, Version 1.0. (See accompanying
87        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>)
88      </p>
89</div></td>
90</tr></table>
91<hr>
92<div class="spirit-nav">
93<a accesskey="p" href="insert.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../new.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="is_sorted.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
94</div>
95</body>
96</html>
97