New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
replace_if.hpp in vendors/XIOS/current/extern/boost/include/boost/range/algorithm – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/range/algorithm/replace_if.hpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
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
18namespace 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
29template< class ForwardRange, class UnaryPredicate, class Value >
30inline 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
40template< class ForwardRange, class UnaryPredicate, class Value >
41inline 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
Note: See TracBrowser for help on using the repository browser.