Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 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 replace_copy] |
| 7 | |
| 8 | [heading Prototype] |
| 9 | |
| 10 | `` |
| 11 | template<class ForwardRange, class OutputIterator, class Value> |
| 12 | OutputIterator replace_copy(const ForwardRange& rng, OutputIterator out, |
| 13 | const Value& what, const Value& with_what); |
| 14 | `` |
| 15 | |
| 16 | [heading Description] |
| 17 | |
| 18 | `replace_copy` copy every element `x` in `rng` such that the corresponding element in the output range `y` is `x == what ? with_what : x`. |
| 19 | |
| 20 | [heading Definition] |
| 21 | |
| 22 | Defined in the header file `boost/range/algorithm/replace_copy.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 | |
| 32 | [heading Complexity] |
| 33 | |
| 34 | Linear. `replace_copy` performs exactly `distance(rng)`. |
| 35 | |
| 36 | [endsect] |
| 37 | |
| 38 | |