8#ifndef ADOBE_ALGORITHM_REPLACE_HPP
9#define ADOBE_ALGORITHM_REPLACE_HPP
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
40template <
class ForwardRange,
class T>
41inline void replace(ForwardRange& range,
const T& old_value,
const T& new_value) {
42 std::replace(boost::begin(range), boost::end(range), old_value, new_value);
50template <
class ForwardIterator,
class Predicate,
class T>
51inline void replace_if(ForwardIterator first, ForwardIterator last, Predicate pred,
53 std::replace_if(first, last, std::bind(pred, std::placeholders::_1), new_value);
61template <
class ForwardRange,
class Predicate,
class T>
62inline void replace_if(ForwardRange& range, Predicate pred,
const T& new_value) {
71template <
class ForwardRange,
class OutputIterator,
class T>
72inline OutputIterator
replace_copy(ForwardRange& range, OutputIterator result,
const T& old_value,
74 return std::replace_copy(boost::begin(range), boost::end(range), result, old_value, new_value);
82template <
class ForwardRange,
class OutputIterator,
class T>
83inline OutputIterator
replace_copy(
const ForwardRange& range, OutputIterator result,
84 const T& old_value,
const T& new_value) {
85 return std::replace_copy(boost::begin(range), boost::end(range), result, old_value, new_value);
93template <
class ForwardIterator,
class OutputIterator,
class Predicate,
class T>
95 OutputIterator result, Predicate pred,
const T& new_value) {
96 return std::replace_copy_if(first, last, result, std::bind(pred, std::placeholders::_1),
105template <
class ForwardRange,
class OutputIterator,
class Predicate,
class T>
106inline OutputIterator
replace_copy_if(ForwardRange& range, OutputIterator result, Predicate pred,
107 const T& new_value) {
116template <
class ForwardRange,
class OutputIterator,
class Predicate,
class T>
117inline OutputIterator
replace_copy_if(
const ForwardRange& range, OutputIterator result,
118 Predicate pred,
const T& new_value) {
OutputIterator replace_copy_if(ForwardIterator first, ForwardIterator last, OutputIterator result, Predicate pred, const T &new_value)
replace implementation
void replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T &new_value)
replace implementation
OutputIterator replace_copy(ForwardRange &range, OutputIterator result, const T &old_value, const T &new_value)
replace implementation
void replace(ForwardRange &range, const T &old_value, const T &new_value)
replace implementation