• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>generate</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="../mutating.html" title="Mutating algorithms">
9<link rel="prev" href="fill_n.html" title="fill_n">
10<link rel="next" href="inplace_merge.html" title="inplace_merge">
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="fill_n.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mutating.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="inplace_merge.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.mutating.generate"></a><a class="link" href="generate.html" title="generate">generate</a>
28</h5></div></div></div>
29<h6>
30<a name="range.reference.algorithms.mutating.generate.h0"></a>
31            <span class="phrase"><a name="range.reference.algorithms.mutating.generate.prototype"></a></span><a class="link" href="generate.html#range.reference.algorithms.mutating.generate.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">Generator</span><span class="special">&gt;</span>
36<span class="identifier">ForwardRange</span><span class="special">&amp;</span> <span class="identifier">generate</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">Generator</span> <span class="identifier">gen</span> <span class="special">);</span>
37
38<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">Generator</span><span class="special">&gt;</span>
39<span class="keyword">const</span> <span class="identifier">ForwardRange</span><span class="special">&amp;</span> <span class="identifier">generate</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">ForwardRange</span><span class="special">&amp;</span> <span class="identifier">rng</span><span class="special">,</span> <span class="identifier">Generator</span> <span class="identifier">gen</span> <span class="special">);</span>
40</pre>
41<p>
42          </p>
43<h6>
44<a name="range.reference.algorithms.mutating.generate.h1"></a>
45            <span class="phrase"><a name="range.reference.algorithms.mutating.generate.description"></a></span><a class="link" href="generate.html#range.reference.algorithms.mutating.generate.description">Description</a>
46          </h6>
47<p>
48            <code class="computeroutput"><span class="identifier">generate</span></code> assigns the
49            result of <code class="computeroutput"><span class="identifier">gen</span><span class="special">()</span></code>
50            to each element in range <code class="computeroutput"><span class="identifier">rng</span></code>.
51            Returns the resultant range.
52          </p>
53<h6>
54<a name="range.reference.algorithms.mutating.generate.h2"></a>
55            <span class="phrase"><a name="range.reference.algorithms.mutating.generate.definition"></a></span><a class="link" href="generate.html#range.reference.algorithms.mutating.generate.definition">Definition</a>
56          </h6>
57<p>
58            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</span><span class="special">/</span><span class="identifier">generate</span><span class="special">.</span><span class="identifier">hpp</span></code>
59          </p>
60<h6>
61<a name="range.reference.algorithms.mutating.generate.h3"></a>
62            <span class="phrase"><a name="range.reference.algorithms.mutating.generate.requirements"></a></span><a class="link" href="generate.html#range.reference.algorithms.mutating.generate.requirements">Requirements</a>
63          </h6>
64<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
65<li class="listitem">
66                <code class="computeroutput"><span class="identifier">ForwardRange</span></code> is a
67                model of the <a class="link" href="../../../concepts/forward_range.html" title="Forward Range">Forward
68                Range</a> Concept.
69              </li>
70<li class="listitem">
71                <code class="computeroutput"><span class="identifier">ForwardRange</span></code> is mutable.
72              </li>
73<li class="listitem">
74                <code class="computeroutput"><span class="identifier">Generator</span></code> is a model
75                of the <code class="computeroutput"><span class="identifier">GeneratorConcept</span></code>.
76              </li>
77<li class="listitem">
78                The <code class="computeroutput"><span class="identifier">value_type</span></code> of
79                <code class="computeroutput"><span class="identifier">SinglePassRange</span></code> is
80                convertible to a type in <code class="computeroutput"><span class="identifier">OutputIterator</span></code>'s
81                set of value types.
82              </li>
83</ul></div>
84<h6>
85<a name="range.reference.algorithms.mutating.generate.h4"></a>
86            <span class="phrase"><a name="range.reference.algorithms.mutating.generate.precondition_"></a></span><a class="link" href="generate.html#range.reference.algorithms.mutating.generate.precondition_">Precondition:</a>
87          </h6>
88<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
89<li class="listitem">
90                <code class="computeroutput"><span class="identifier">out_it</span></code> is not an
91                iterator within <code class="computeroutput"><span class="identifier">rng</span></code>.
92              </li>
93<li class="listitem">
94                <code class="computeroutput"><span class="special">[</span><span class="identifier">out_it</span><span class="special">,</span> <span class="identifier">out_it</span>
95                <span class="special">+</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng</span><span class="special">))</span></code> is a valid range.
96              </li>
97</ul></div>
98<h6>
99<a name="range.reference.algorithms.mutating.generate.h5"></a>
100            <span class="phrase"><a name="range.reference.algorithms.mutating.generate.complexity"></a></span><a class="link" href="generate.html#range.reference.algorithms.mutating.generate.complexity">Complexity</a>
101          </h6>
102<p>
103            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 are performed.
104          </p>
105</div>
106<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
107<td align="left"></td>
108<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
109      Neil Groves<p>
110        Distributed under the Boost Software License, Version 1.0. (See accompanying
111        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>)
112      </p>
113</div></td>
114</tr></table>
115<hr>
116<div class="spirit-nav">
117<a accesskey="p" href="fill_n.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mutating.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="inplace_merge.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
118</div>
119</body>
120</html>
121