]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/include/boost/range/algorithm/replace_if.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / range / include / boost / range / algorithm / replace_if.hpp
1 // Copyright Neil Groves 2009. Use, modification and
2 // distribution is subject to the Boost Software License, Version
3 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 //
6 //
7 // For more information, see http://www.boost.org/libs/range/
8 //
9 #ifndef BOOST_RANGE_ALGORITHM_REPLACE_IF_HPP_INCLUDED
10 #define BOOST_RANGE_ALGORITHM_REPLACE_IF_HPP_INCLUDED
11
12 #include <boost/concept_check.hpp>
13 #include <boost/range/begin.hpp>
14 #include <boost/range/end.hpp>
15 #include <boost/range/concepts.hpp>
16 #include <algorithm>
17
18 namespace boost
19 {
20 namespace range
21 {
22
23 /// \brief template function replace_if
24 ///
25 /// range-based version of the replace_if std algorithm
26 ///
27 /// \pre ForwardRange is a model of the ForwardRangeConcept
28 /// \pre UnaryPredicate is a model of the UnaryPredicateConcept
29 template< class ForwardRange, class UnaryPredicate, class Value >
30 inline ForwardRange&
31 replace_if(ForwardRange& rng, UnaryPredicate pred,
32 const Value& val)
33 {
34 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
35 std::replace_if(boost::begin(rng), boost::end(rng), pred, val);
36 return rng;
37 }
38
39 /// \overload
40 template< class ForwardRange, class UnaryPredicate, class Value >
41 inline const ForwardRange&
42 replace_if(const ForwardRange& rng, UnaryPredicate pred,
43 const Value& val)
44 {
45 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
46 std::replace_if(boost::begin(rng), boost::end(rng), pred, val);
47 return rng;
48 }
49
50 } // namespace range
51 using range::replace_if;
52 } // namespace boost
53
54 #endif // include guard