]>
Commit | Line | Data |
---|---|---|
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 replace] | |
7 | ||
8 | [heading Prototype] | |
9 | ||
10 | `` | |
11 | template< | |
12 | class ForwardRange, | |
13 | class Value | |
14 | > | |
15 | ForwardRange& replace(ForwardRange& rng, const Value& what, const Value& with_what); | |
16 | ||
17 | template< | |
18 | class ForwardRange, | |
19 | class UnaryPredicate | |
20 | > | |
21 | const ForwardRange& replace(const ForwardRange& rng, const Value& what, const Value& with_what); | |
22 | `` | |
23 | ||
24 | [heading Description] | |
25 | ||
26 | `replace` every element in `rng` equal to `what` with `with_what`. Return a reference to `rng`. | |
27 | ||
28 | [heading Definition] | |
29 | ||
30 | Defined in the header file `boost/range/algorithm/replace.hpp` | |
31 | ||
32 | [heading Requirements] | |
33 | ||
34 | * `ForwardRange` is a model of the __forward_range__ Concept. | |
35 | * `ForwardRange` is mutable. | |
36 | * `Value` is convertible to `ForwardRange`'s value type. | |
37 | * `Value` is a model of the `AssignableConcept`. | |
38 | * `Value` is a model of the `EqualityComparableConcept`, and may be compared for equality with objects of `ForwardRange`'s value type. | |
39 | ||
40 | [heading Complexity] | |
41 | ||
42 | Linear. `replace` performs exactly `distance(rng)` comparisons for equality and at most `distance(rng)` assignments. | |
43 | ||
44 | [endsect] | |
45 | ||
46 |