123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- #ifndef BOOST_ALGORITHM_GATHER_HPP
- #define BOOST_ALGORITHM_GATHER_HPP
- #include <algorithm>
- #include <functional>
- #include <boost/bind.hpp>
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- namespace boost { namespace algorithm {
- template <
- typename BidirectionalIterator,
- typename Pred>
- std::pair<BidirectionalIterator, BidirectionalIterator> gather
- ( BidirectionalIterator first, BidirectionalIterator last, BidirectionalIterator pivot, Pred pred )
- {
- return std::make_pair (
- std::stable_partition ( first, pivot, !boost::bind<bool> ( pred, _1 )),
- std::stable_partition ( pivot, last, boost::bind<bool> ( pred, _1 )));
- }
- template <
- typename BidirectionalRange,
- typename Pred>
- std::pair<
- typename boost::range_iterator<const BidirectionalRange>::type,
- typename boost::range_iterator<const BidirectionalRange>::type>
- gather (
- const BidirectionalRange &range,
- typename boost::range_iterator<const BidirectionalRange>::type pivot,
- Pred pred )
- {
- return boost::algorithm::gather ( boost::begin ( range ), boost::end ( range ), pivot, pred );
- }
- }}
- #endif
|