]>
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_copy_if replace_copy_if] | |
7 | ||
8 | [heading Prototype] | |
9 | ||
10 | `` | |
11 | template<class ForwardRange, class OutputIterator, class UnaryPredicate, class Value> | |
12 | OutputIterator replace_copy_if(const ForwardRange& rng, OutputIterator out, | |
13 | UnaryPredicate pred, const Value& with_what); | |
14 | `` | |
15 | ||
16 | [heading Description] | |
17 | ||
18 | `replace_copy_if` copy every element `x` in `rng` such that the corresponding element in the output range `y` is `pred(x) ? with_what : x`. | |
19 | ||
20 | [heading Definition] | |
21 | ||
22 | Defined in the header file `boost/range/algorithm/replace_copy_if.hpp` | |
23 | ||
24 | [heading Requirements] | |
25 | ||
26 | * `ForwardRange` is a model of the __forward_range__ Concept. | |
27 | * `ForwardRange` is mutable. | |
28 | * `Value` is convertible to `ForwardRange`'s value type. | |
29 | * `Value` is a model of the `AssignableConcept`. | |
30 | * `OutputIterator` is a model of the `OutputIteratorConcept`. | |
31 | * `UnaryPredicate` is a model of the `UnaryPredicateConcept`. | |
32 | ||
33 | [heading Complexity] | |
34 | ||
35 | Linear. `replace_copy_if` performs exactly `distance(rng)` evaluations of `pred`. | |
36 | ||
37 | [endsect] | |
38 | ||
39 |