]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/doc/reference/adaptors/replaced_if.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / range / doc / reference / adaptors / replaced_if.qbk
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:replaced_if replaced_if]
7
8 [table
9 [[Syntax] [Code]]
10 [[Pipe] [`rng | boost::adaptors::replaced_if(pred, new_value)`]]
11 [[Function] [`boost::adaptors::replace_if(rng, pred, new_value)`]]
12 ]
13
14 * [*Precondition:]
15 * The range `value_type` is convertible to the argument type of `pred`.
16 * `new_value` is convertible to the `value_type` of the range.
17 * [*Postconditions:] For all elements `x` in the returned range, the value `x` is equal to the value of `pred(y) ? new_value : y` where `y` is the corresponding element in the original range.
18 * [*Range Category:] __single_pass_range__
19 * [*Range Return Type:] `boost::replaced_if_range<decltype(rng)>`
20 * [*Returned Range Category:] The range category of `rng`.
21
22 [section:replaced_if_example replaced_if example]
23 [import ../../../test/adaptor_test/replaced_if_example.cpp]
24 [replaced_if_example]
25 [endsect]
26
27 This would produce the output:
28 ``
29 1,10,3,10,5,10,7,10,9,
30 ``
31 [endsect]
32
33