12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef BOOST_RANGE_ALGORITHM_PARTIAL_SORT_HPP_INCLUDED
- #define BOOST_RANGE_ALGORITHM_PARTIAL_SORT_HPP_INCLUDED
- #include <boost/concept_check.hpp>
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- #include <boost/range/concepts.hpp>
- #include <algorithm>
- namespace boost
- {
- namespace range
- {
- template<class RandomAccessRange>
- inline RandomAccessRange& partial_sort(RandomAccessRange& rng,
- BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type middle)
- {
- BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
- std::partial_sort(boost::begin(rng), middle, boost::end(rng));
- return rng;
- }
- template<class RandomAccessRange>
- inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng,
- BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type middle)
- {
- BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
- std::partial_sort(boost::begin(rng), middle, boost::end(rng));
- return rng;
- }
- template<class RandomAccessRange, class BinaryPredicate>
- inline RandomAccessRange& partial_sort(RandomAccessRange& rng,
- BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type middle,
- BinaryPredicate sort_pred)
- {
- BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
- std::partial_sort(boost::begin(rng), middle, boost::end(rng),
- sort_pred);
- return rng;
- }
- template<class RandomAccessRange, class BinaryPredicate>
- inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng,
- BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type middle,
- BinaryPredicate sort_pred)
- {
- BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
- std::partial_sort(boost::begin(rng), middle, boost::end(rng),
- sort_pred);
- return rng;
- }
- }
- using range::partial_sort;
- }
- #endif
|