]>
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:transformed transformed] | |
7 | ||
8 | [table | |
9 | [[Syntax] [Code]] | |
10 | [[Pipe] [`rng | boost::adaptors::transformed(fun)`]] | |
11 | [[Function] [`boost::adaptors::transform(rng, fun)`]] | |
12 | ] | |
13 | ||
14 | * [*Precondition:] The `value_type` of the range is convertible to the argument type of `fun`. | |
15 | * [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `fun(y)` where `y` is the corresponding element in the original range. | |
16 | * [*Throws:] Whatever the copy-constructor of `fun` might throw. | |
17 | * [*Range Category:] __single_pass_range__ | |
18 | * [*Range Return Type:] `boost::transformed_range<decltype(rng)>` | |
19 | * [*Returned Range Category:] The range category of `rng`. | |
20 | ||
21 | [section:transformed_example transformed example] | |
22 | [import ../../../test/adaptor_test/transformed_example.cpp] | |
23 | [transformed_example] | |
24 | [endsect] | |
25 | ||
26 | This would produce the output: | |
27 | `` | |
28 | 2,4,6,8,10,12,14,16,18,20, | |
29 | `` | |
30 | [endsect] | |
31 | ||
32 |