]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/doc/reference/adaptors/replaced.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / range / doc / reference / adaptors / replaced.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 replaced]
7
8 [table
9 [[Syntax] [Code]]
10 [[Pipe] [`rng | boost::adaptors::replaced(new_value, old_value)`]]
11 [[Function] [`boost::adaptors::replace(rng, new_value, old_value)`]]
12 ]
13
14 * [*Precondition:]
15 * `new_value` is convertible to the `value_type` of the range.
16 * `old_value` is convertible to the `value_type` of the range.
17 * [*Postcondition:] For all elements `x` in the returned range, the value `x` is equal to the value of `(y == old_value) ? 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_range<decltype(rng)>`
20 * [*Returned Range Category:] The range category of `rng`.
21
22 [section:replaced_example replaced example]
23 [import ../../../test/adaptor_test/replaced_example.cpp]
24 [replaced_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