]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
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 | `` | |
11 | template<class ForwardRange, class Generator> | |
12 | ForwardRange& generate( ForwardRange& rng, Generator gen ); | |
13 | ||
14 | template<class ForwardRange, class Generator> | |
15 | const 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 | ||
24 | Defined 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 | ||
40 | Linear. Exactly `distance(rng)` assignments are performed. | |
41 | ||
42 | [endsect] | |
43 | ||
44 |