template <class BidirectionalIterator, class UnaryPredicate> BidirectionalIterator partition (BidirectionalIterator first, BidirectionalIterator last, UnaryPredicate pred);
template <class ForwardIterator, class UnaryPredicate> ForwardIterator partition (ForwardIterator first, ForwardIterator last, UnaryPredicate pred);
[first,last) 中的元素,使得所有 pred 返回 true 的元素都位於 pred 返回 false 的元素之前。返回的迭代器指向第二個組的第一個元素。 |
|
bool 的值。返回值指示元素是否應放在前面(如果為 true,則該元素放在所有 pred 返回 false 的元素之前)。false 的元素)的第一個元素的迭代器,如果該組為空,則為 last。 |
|
odd elements: 1 9 3 7 5 even elements: 6 4 8 2 |
[first,last)內的物件將被修改。