stlab.adobe.com Adobe Systems Incorporated

partition.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 
00007 /*************************************************************************************************/
00008 
00009 #ifndef ADOBE_ALGORITHM_PARTITION_HPP
00010 #define ADOBE_ALGORITHM_PARTITION_HPP
00011 
00012 #include <adobe/config.hpp>
00013 
00014 #include <boost/range/begin.hpp>
00015 #include <boost/range/end.hpp>
00016 #include <boost/bind.hpp>
00017 
00018 #include <algorithm>
00019 
00020 /*************************************************************************************************/
00021 
00022 namespace adobe {
00023 
00024 /*************************************************************************************************/
00033 /*************************************************************************************************/
00039 template <class BidirectionalIterator, class Predicate>
00040 inline BidirectionalIterator
00041 partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
00042 {
00043     return std::partition(first, last, boost::bind(pred, _1));
00044 }
00045 
00051 template <class BidirectionalRange, class Predicate>
00052 inline typename boost::range_iterator<BidirectionalRange>::type
00053 partition(BidirectionalRange& range, Predicate pred)
00054 {
00055     return adobe::partition(boost::begin(range), boost::end(range), pred);
00056 }
00057 
00063 template <class BidirectionalIterator, class Predicate>
00064 inline BidirectionalIterator
00065 stable_partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred)
00066 {
00067     return std::stable_partition(first, last, boost::bind(pred, _1));
00068 }
00069 
00075 template <class BidirectionalRange, class Predicate>
00076 inline typename boost::range_iterator<BidirectionalRange>::type
00077 stable_partition(BidirectionalRange& range, Predicate pred)
00078 {
00079     return adobe::stable_partition(boost::begin(range), boost::end(range), pred);
00080 }
00081 
00082 /*************************************************************************************************/
00083 
00084 } // namespace adobe
00085 
00086 /*************************************************************************************************/
00087 
00088 #endif
00089 
00090 /*************************************************************************************************/

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