Adobe Source Libraries 2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
partition.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
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/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_PARTITION_HPP
9#define ADOBE_ALGORITHM_PARTITION_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15
16#include <algorithm>
17#include <functional>
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
32/**************************************************************************************************/
38template <class BidirectionalIterator, class Predicate>
39inline BidirectionalIterator partition(BidirectionalIterator first, BidirectionalIterator last,
40 Predicate pred) {
41 return std::partition(first, last, std::bind(pred, std::placeholders::_1));
42}
43
49template <class BidirectionalRange, class Predicate>
50inline typename boost::range_iterator<BidirectionalRange>::type partition(BidirectionalRange& range,
51 Predicate pred) {
52 return adobe::partition(boost::begin(range), boost::end(range), pred);
53}
54
60template <class BidirectionalIterator, class Predicate>
61inline BidirectionalIterator stable_partition(BidirectionalIterator first,
62 BidirectionalIterator last, Predicate pred) {
63 return std::stable_partition(first, last, std::bind(pred, std::placeholders::_1));
64}
65
71template <class BidirectionalRange, class Predicate>
72inline typename boost::range_iterator<BidirectionalRange>::type
73stable_partition(BidirectionalRange& range, Predicate pred) {
74 return adobe::stable_partition(boost::begin(range), boost::end(range), pred);
75}
76
77/**************************************************************************************************/
78
79} // namespace adobe
80
81/**************************************************************************************************/
82
83#endif
84
85/**************************************************************************************************/
BidirectionalIterator partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
partition implementation
Definition partition.hpp:39
BidirectionalIterator stable_partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
partition implementation
Definition partition.hpp:61