• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright 2010 Neil Groves
3    Distributed under the Boost Software License, Version 1.0.
4    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:remove_if remove_if]
7
8[heading Prototype]
9
10``
11template<
12    class ForwardRange,
13    class UnaryPredicate
14    >
15typename range_iterator<ForwardRange>::type
16remove_if(ForwardRange& rng, UnaryPredicate pred);
17
18template<
19    class ForwardRange,
20    class UnaryPredicate
21    >
22typename range_iterator<const ForwardRange>::type
23remove_if(const ForwardRange& rng, UnaryPredicate pred);
24
25template<
26    range_return_value re,
27    class ForwardRange,
28    class UnaryPredicate
29    >
30typename range_return<ForwardRange,re>::type
31remove_if(ForwardRange& rng, UnaryPredicate pred);
32
33template<
34    range_return_value re,
35    class ForwardRange,
36    class UnaryPredicate
37    >
38typename range_return<const ForwardRange,re>::type
39remove_if(const ForwardRange& rng, UnaryPredicate pred);
40``
41
42[heading Description]
43
44`remove_if` removes from `rng` all of the elements `x` for which `pred(x)` is `true`. The versions of `remove_if` that return an iterator, return an iterator `new_last` such that the range `[begin(rng), new_last)` contains no elements where `pred(x)` is `true`. The iterators in the range `[new_last, end(rng))` are dereferenceable, but the elements are unspecified.
45
46[heading Definition]
47
48Defined in the header file `boost/range/algorithm/remove_if.hpp`
49
50[heading Requirements]
51
52* `ForwardRange` is a model of the __forward_range__ Concept.
53* `ForwardRange` is mutable.
54* `UnaryPredicate` is a model of the `PredicateConcept`.
55* `ForwardRange`'s value type is convertible to `UnaryPredicate`'s argument type.
56
57[heading Complexity]
58
59Linear. `remove_if` performs exactly `distance(rng)` applications of `pred`.
60
61[endsect]
62
63
64