Namespaces
Variants
Views
Actions

std::is_partitioned

From cppreference.com
< cpp‎ | algorithm
Revision as of 06:40, 24 August 2011 by Cubbi (Talk | contribs)

Template:cpp/algorithm/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <algorithm>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class InputIterator, class UnaryPredicate >
bool is_partitioned(InputIterator first, InputIterator last, UnaryPredicate p);
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

Returns Template:cpp if all elements in the range [first, last) that satisfy the predicate p appear before all elements that don't. Also returns Template:cpp if [first, last) is empty.

Contents

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 expression p(v) must be convertible to bool for every argument v of type (possibly const) VT, where VT is the value type of InputIterator, regardless of value category, and must not modify v. Thus, a parameter type of VT&is not allowed, nor is VT unless for VT a move is equivalent to a copy(since C++11). ​

Return value

Template:cpp if the range [first, last) is empty or is partitioned by p. Template:cpp otherwise.

Complexity

At most std::distance(first, last) applications of p.

Equivalent function

Template:eq fun cpp

Example

Template:example cpp

See also

Template:cpp/algorithm/dcl list partitionTemplate:cpp/algorithm/dcl list partition point