]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/range/doc/reference/algorithm/partition.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / range / doc / reference / algorithm / partition.qbk
CommitLineData
7c673cae
FG
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:partition partition]
7
8[heading Prototype]
9
10``
11template<
12 class ForwardRange,
13 class UnaryPredicate
14 >
15typename range_iterator<ForwardRange>::type
16partition(ForwardRange& rng, UnaryPredicate pred);
17
18template<
19 class ForwardRange,
20 class UnaryPredicate
21 >
22typename range_iterator<const ForwardRange>::type
23partition(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
31partition(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
39partition(const ForwardRange& rng, UnaryPredicate pred);
40``
41
42[heading Description]
43
44`partition` orders the elements in `rng` based on `pred`, such that the elements that satisfy `pred` precede the elements that do not. In the versions that return a single iterator, the return value is the middle iterator. In the versions that have a configurable range_return, `found` corresponds to the middle iterator.
45
46
47[heading Definition]
48
49Defined in the header file `boost/range/algorithm/partition.hpp`
50
51[heading Requirements]
52
53* `ForwardRange` is a model of the __forward_range__ Concept. For C++ versions prior to C++11 the underlying std::partition requires Bidirectional Iterators, hence the requirement for older library versions is for a __bidirectional_range__.
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. Exactly `distance(rng)` applications of `pred`, and at most `distance(rng) / 2` swaps.
60
61[endsect]
62
63