blob: 3d196641a4bdabb845bf433b296aa98ddfd65d9b [file] [log] [blame]
Brian Silverman598d0292018-08-04 23:56:47 -07001[/
2 Copyright 2010 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:generate generate]
7
8[heading Prototype]
9
10``
11template<class ForwardRange, class Generator>
12ForwardRange& generate( ForwardRange& rng, Generator gen );
13
14template<class ForwardRange, class Generator>
15const ForwardRange& generate( const ForwardRange& rng, Generator gen );
16``
17
18[heading Description]
19
20`generate` assigns the result of `gen()` to each element in range `rng`. Returns the resultant range.
21
22[heading Definition]
23
24Defined in the header file `boost/range/algorithm/generate.hpp`
25
26[heading Requirements]
27
28* `ForwardRange` is a model of the __forward_range__ Concept.
29* `ForwardRange` is mutable.
30* `Generator` is a model of the `GeneratorConcept`.
31* The `value_type` of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
32
33[heading Precondition:]
34
35* `out_it` is not an iterator within `rng`.
36* `[out_it, out_it + distance(rng))` is a valid range.
37
38[heading Complexity]
39
40Linear. Exactly `distance(rng)` assignments are performed.
41
42[endsect]
43
44