]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/doc/reference/algorithm/replace_if.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / range / doc / reference / algorithm / replace_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:replace_if replace_if]
7
8 [heading Prototype]
9
10 ``
11 template<class ForwardRange, class UnaryPredicate, class Value>
12 ForwardRange& replace_if(ForwardRange& rng, UnaryPredicate pred, const Value& with_what);
13
14 template<class ForwardRange, class UnaryPredicate, class Value>
15 const ForwardRange& replace_if(const ForwardRange& rng, UnaryPredicate pred, const Value& with_what);
16 ``
17
18 [heading Description]
19
20 `replace_if` replaces every element `x` in `rng` for which `pred(x) == true` with `with_what`. Returns a reference to `rng`.
21
22 [heading Definition]
23
24 Defined in the header file `boost/range/algorithm/replace_if.hpp`
25
26 [heading Requirements]
27
28 * `ForwardRange` is a model of the __forward_range__ Concept.
29 * `ForwardRange` is mutable.
30 * `UnaryPredicate` is a model of the `PredicateConcept`
31 * `ForwardRange`'s value type is convertible to `UnaryPredicate`'s argument type.
32 * `Value` is convertible to `ForwardRange`'s value type.
33 * `Value` is a model of the `AssignableConcept`.
34
35 [heading Complexity]
36
37 Linear. `replace_if` performs exactly `distance(rng)` applications of `pred`, and at most `distance(rng)` assignments.
38
39 [endsect]
40
41