stlab.adobe.com Adobe Systems Incorporated
partition.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 */
6 
7 /*************************************************************************************************/
8 
9 #ifndef ADOBE_ALGORITHM_PARTITION_HPP
10 #define ADOBE_ALGORITHM_PARTITION_HPP
11 
12 #include <adobe/config.hpp>
13 
14 #include <boost/range/begin.hpp>
15 #include <boost/range/end.hpp>
16 #include <boost/bind.hpp>
17 
18 #include <algorithm>
19 
20 /*************************************************************************************************/
21 
22 namespace adobe {
23 
24 /*************************************************************************************************/
33 /*************************************************************************************************/
39 template <class BidirectionalIterator, class Predicate>
40 inline BidirectionalIterator
41 partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
42 {
43  return std::partition(first, last, boost::bind(pred, _1));
44 }
45 
51 template <class BidirectionalRange, class Predicate>
52 inline typename boost::range_iterator<BidirectionalRange>::type
53 partition(BidirectionalRange& range, Predicate pred)
54 {
55  return adobe::partition(boost::begin(range), boost::end(range), pred);
56 }
57 
63 template <class BidirectionalIterator, class Predicate>
64 inline BidirectionalIterator
65 stable_partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
66 {
67  return std::stable_partition(first, last, boost::bind(pred, _1));
68 }
69 
75 template <class BidirectionalRange, class Predicate>
76 inline typename boost::range_iterator<BidirectionalRange>::type
77 stable_partition(BidirectionalRange& range, Predicate pred)
78 {
79  return adobe::stable_partition(boost::begin(range), boost::end(range), pred);
80 }
81 
82 /*************************************************************************************************/
83 
84 } // namespace adobe
85 
86 /*************************************************************************************************/
87 
88 #endif
89 
90 /*************************************************************************************************/
BidirectionalIterator stable_partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
partition implementation
Definition: partition.hpp:65
boost::range_iterator< BidirectionalRange >::type partition(BidirectionalRange &range, Predicate pred)
partition implementation
Definition: partition.hpp:53
BidirectionalIterator partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
partition implementation
Definition: partition.hpp:41
boost::range_iterator< BidirectionalRange >::type stable_partition(BidirectionalRange &range, Predicate pred)
partition implementation
Definition: partition.hpp:77

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google