This topic has not yet been rated - Rate this topic

partition_copy

Copies elements for which a condition is true to one destination, and for which the condition is false to another. The elements must come from a specified range.

template<class InputIterator, class OutputIterator1, class OutputIterator2, class Predicate>
    pair<OutputIterator1, OutputIterator2>
        partition_copy(
            InputIterator _First, 
            InputIterator _Last,
            OutputIterator1 _Dest1, 
            OutputIterator2 _Dest2, 
            Predicate _Pred
        );
_First

An input iterator that indicates the beginning of a range to check for a condition.

_Last

An input iterator that indicates the end of a range.

_Dest1

An output iterator used to copy elements that return true for a condition tested by using _Pred.

_Dest2

An output iterator used to copy elements that return false for a condition tested by using _Pred.

_Pred

The condition to test for. This is provided by a user-defined predicate function object that defines the condition to be tested. A predicate takes a single argument and returns true or false.

Returns a pair that contains two OutputIterator objects, one that contains elements that exhibit the condition, the other contains elements that do not.

The template function copies each element X in [_First, _Last) to *_Dest1++ if _Pred(X) is true, or to *_Dest2++ if not. It returns pair<OutputIterator1, OutputIterator2>(_Dest1, _Dest2).

Header: <algorithm>

Namespace: std

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.