std::is_partitioned
From Cppreference
Defined in header <algorithm>
|
||
template< class InputIterator, class UnaryPredicate >
bool is_partitioned( InputIterator first, InputIterator last, UnaryPredicate p ); |
(C++11 feature) | |
Returns true if all elements in the range [first, last) that satisfy the predicate p appear before all elements that don't. Also returns true if [first, last) is empty.
Contents |
[edit] Parameters
first, last | - | the range of elements to check | |||||||||
p | - | unary predicate which returns true for the elements expected to be found in the beginning of the range. The signature of the predicate function should be equivalent to the following:
The signature does not need to have const &, but the function must not modify the objects passed to it. |
[edit] Return value
true if the range [first, last) is empty or is partitioned by p. false otherwise.
[edit] Complexity
At most std::distance(first, last) applications of p.
[edit] Equivalent function
template< class InputIterator, class UnaryPredicate > bool is_partitioned(InputIterator first, InputIterator last, UnaryPredicate p) { for (; first != last; ++first) if (!p(*first)) break; for (; first != last; ++first) if (p(*first)) return false; return true; } |
[edit] Example
This section is incomplete |
[edit] See also
|
divides a range of elements into two groups (function template) |
||
|
locates the partition point of a partitioned range (function template) |