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.
remove_if.hpp in vendors/XIOS/current/extern/boost/include/boost/range/algorithm – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/range/algorithm/remove_if.hpp @ 3428

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

importing initial XIOS vendor drop

File size: 2.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_REMOVE_IF_HPP_INCLUDED
10#define BOOST_RANGE_ALGORITHM_REMOVE_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 <boost/range/detail/range_return.hpp>
17#include <algorithm>
18
19namespace boost
20{
21    namespace range
22    {
23
24/// \brief template function remove_if
25///
26/// range-based version of the remove_if std algorithm
27///
28/// \pre ForwardRange is a model of the ForwardRangeConcept
29/// \pre UnaryPredicate is a model of the UnaryPredicateConcept
30template< class ForwardRange, class UnaryPredicate >
31inline BOOST_DEDUCED_TYPENAME boost::range_iterator<ForwardRange>::type
32remove_if(ForwardRange& rng, UnaryPredicate pred)
33{
34    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
35    return std::remove_if(boost::begin(rng), boost::end(rng), pred);
36}
37
38/// \overload
39template< class ForwardRange, class UnaryPredicate >
40inline BOOST_DEDUCED_TYPENAME boost::range_iterator<const ForwardRange>::type
41remove_if(const ForwardRange& rng, UnaryPredicate pred)
42{
43    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
44    return std::remove_if(boost::begin(rng), boost::end(rng), pred);
45}
46
47// range_return overloads
48
49/// \overload
50template< range_return_value re, class ForwardRange, class UnaryPredicate >
51inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
52remove_if(ForwardRange& rng, UnaryPredicate pred)
53{
54    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
55    return range_return<ForwardRange,re>::pack(
56        std::remove_if(boost::begin(rng), boost::end(rng), pred),
57        rng);
58}
59
60/// \overload
61template< range_return_value re, class ForwardRange, class UnaryPredicate >
62inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
63remove_if(const ForwardRange& rng, UnaryPredicate pred)
64{
65    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
66    return range_return<const ForwardRange,re>::pack(
67        std::remove_if(boost::begin(rng), boost::end(rng), pred),
68        rng);
69}
70
71    } // namespace range
72    using range::remove_if;
73} // namespace boost
74
75#endif // include guard
Note: See TracBrowser for help on using the repository browser.