source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/extern/boost/include/boost/range/algorithm/replace.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

File size: 1.5 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_HPP_INCLUDED
10#define BOOST_RANGE_ALGORITHM_REPLACE_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
24///
25/// range-based version of the replace std algorithm
26///
27/// \pre ForwardRange is a model of the ForwardRangeConcept
28template< class ForwardRange, class Value >
29inline ForwardRange&
30replace(ForwardRange& rng, const Value& what,
31        const Value& with_what)
32{
33    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
34    std::replace(boost::begin(rng), boost::end(rng), what, with_what);
35    return rng;
36}
37
38/// \overload
39template< class ForwardRange, class Value >
40inline const ForwardRange&
41replace(const ForwardRange& rng, const Value& what,
42        const Value& with_what)
43{
44    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
45    std::replace(boost::begin(rng), boost::end(rng), what, with_what);
46    return rng;
47}
48
49    } // namespace range
50    using range::replace;
51} // namespace boost;
52
53#endif // include guard
Note: See TracBrowser for help on using the repository browser.