File indexing completed on 2025-01-30 09:59:16
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_RANGE_ALGORITHM_HEAP_ALGORITHM_HPP_INCLUDED
0010 #define BOOST_RANGE_ALGORITHM_HEAP_ALGORITHM_HPP_INCLUDED
0011
0012 #include <boost/concept_check.hpp>
0013 #include <boost/range/begin.hpp>
0014 #include <boost/range/end.hpp>
0015 #include <boost/range/concepts.hpp>
0016 #include <algorithm>
0017
0018 namespace boost
0019 {
0020 namespace range
0021 {
0022
0023
0024
0025
0026
0027
0028
0029 template<class RandomAccessRange>
0030 inline RandomAccessRange& push_heap(RandomAccessRange& rng)
0031 {
0032 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0033 std::push_heap(boost::begin(rng), boost::end(rng));
0034 return rng;
0035 }
0036
0037
0038 template<class RandomAccessRange>
0039 inline const RandomAccessRange& push_heap(const RandomAccessRange& rng)
0040 {
0041 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0042 std::push_heap(boost::begin(rng), boost::end(rng));
0043 return rng;
0044 }
0045
0046
0047 template<class RandomAccessRange, class Compare>
0048 inline RandomAccessRange& push_heap(RandomAccessRange& rng, Compare comp_pred)
0049 {
0050 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0051 std::push_heap(boost::begin(rng), boost::end(rng), comp_pred);
0052 return rng;
0053 }
0054
0055
0056 template<class RandomAccessRange, class Compare>
0057 inline const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare comp_pred)
0058 {
0059 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0060 std::push_heap(boost::begin(rng), boost::end(rng), comp_pred);
0061 return rng;
0062 }
0063
0064
0065
0066
0067
0068
0069
0070 template<class RandomAccessRange>
0071 inline RandomAccessRange& pop_heap(RandomAccessRange& rng)
0072 {
0073 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0074 std::pop_heap(boost::begin(rng), boost::end(rng));
0075 return rng;
0076 }
0077
0078
0079 template<class RandomAccessRange>
0080 inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng)
0081 {
0082 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0083 std::pop_heap(boost::begin(rng), boost::end(rng));
0084 return rng;
0085 }
0086
0087
0088 template<class RandomAccessRange, class Compare>
0089 inline RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare comp_pred)
0090 {
0091 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0092 std::pop_heap(boost::begin(rng), boost::end(rng), comp_pred);
0093 return rng;
0094 }
0095
0096
0097 template<class RandomAccessRange, class Compare>
0098 inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare comp_pred)
0099 {
0100 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0101 std::pop_heap(boost::begin(rng), boost::end(rng), comp_pred);
0102 return rng;
0103 }
0104
0105
0106
0107
0108
0109
0110
0111 template<class RandomAccessRange>
0112 inline RandomAccessRange& make_heap(RandomAccessRange& rng)
0113 {
0114 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0115 std::make_heap(boost::begin(rng), boost::end(rng));
0116 return rng;
0117 }
0118
0119
0120 template<class RandomAccessRange>
0121 inline const RandomAccessRange& make_heap(const RandomAccessRange& rng)
0122 {
0123 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0124 std::make_heap(boost::begin(rng), boost::end(rng));
0125 return rng;
0126 }
0127
0128
0129 template<class RandomAccessRange, class Compare>
0130 inline RandomAccessRange& make_heap(RandomAccessRange& rng, Compare comp_pred)
0131 {
0132 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0133 std::make_heap(boost::begin(rng), boost::end(rng), comp_pred);
0134 return rng;
0135 }
0136
0137
0138 template<class RandomAccessRange, class Compare>
0139 inline const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare comp_pred)
0140 {
0141 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0142 std::make_heap(boost::begin(rng), boost::end(rng), comp_pred);
0143 return rng;
0144 }
0145
0146
0147
0148
0149
0150
0151
0152 template<class RandomAccessRange>
0153 inline RandomAccessRange& sort_heap(RandomAccessRange& rng)
0154 {
0155 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0156 std::sort_heap(boost::begin(rng), boost::end(rng));
0157 return rng;
0158 }
0159
0160
0161 template<class RandomAccessRange>
0162 inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng)
0163 {
0164 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0165 std::sort_heap(boost::begin(rng), boost::end(rng));
0166 return rng;
0167 }
0168
0169
0170 template<class RandomAccessRange, class Compare>
0171 inline RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare comp_pred)
0172 {
0173 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
0174 std::sort_heap(boost::begin(rng), boost::end(rng), comp_pred);
0175 return rng;
0176 }
0177
0178
0179 template<class RandomAccessRange, class Compare>
0180 inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare comp_pred)
0181 {
0182 BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
0183 std::sort_heap(boost::begin(rng), boost::end(rng), comp_pred);
0184 return rng;
0185 }
0186
0187 }
0188 using range::push_heap;
0189 using range::pop_heap;
0190 using range::make_heap;
0191 using range::sort_heap;
0192 }
0193
0194 #endif