stlab.adobe.com Adobe Systems Incorporated
heap.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_HEAP_HPP
10 #define ADOBE_ALGORITHM_HEAP_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 /*************************************************************************************************/
35 /*************************************************************************************************/
41 template <class RandomAccessRange>
42 inline void push_heap(RandomAccessRange& range)
43 {
44  return std::push_heap(boost::begin(range), boost::end(range));
45 }
46 
52 template <class RandomAccessIterator, class Compare>
53 inline void push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
54 {
55  return std::push_heap(first, last, boost::bind(comp, _1, _2));
56 }
57 
63 template <class RandomAccessRange, class Compare>
64 inline void push_heap(RandomAccessRange& range, Compare comp)
65 {
66  return adobe::push_heap(boost::begin(range), boost::end(range), comp);
67 }
68 
74 template <class RandomAccessRange>
75 inline void pop_heap(RandomAccessRange& range)
76 {
77  return std::pop_heap(boost::begin(range), boost::end(range));
78 }
79 
85 template <class RandomAccessIterator, class Compare>
86 inline void pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
87 {
88  return std::pop_heap(first, last, boost::bind(comp, _1, _2));
89 }
90 
96 template <class RandomAccessRange, class Compare>
97 inline void pop_heap(RandomAccessRange& range, Compare comp)
98 {
99  return adobe::pop_heap(boost::begin(range), boost::end(range), comp);
100 }
101 
107 template <class RandomAccessRange>
108 inline void make_heap(RandomAccessRange& range)
109 {
110  return std::make_heap(boost::begin(range), boost::end(range));
111 }
112 
118 template <class RandomAccessIterator, class Compare>
119 inline void make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
120 {
121  return std::make_heap(first, last, boost::bind(comp, _1, _2));
122 }
123 
129 template <class RandomAccessRange, class Compare>
130 inline void make_heap(RandomAccessRange& range, Compare comp)
131 {
132  return adobe::make_heap(boost::begin(range), boost::end(range), comp);
133 }
134 
140 template <class RandomAccessRange>
141 inline void sort_heap(RandomAccessRange& range)
142 {
143  return std::sort_heap(boost::begin(range), boost::end(range));
144 }
145 
151 template <class RandomAccessIterator, class Compare>
152 inline void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
153 {
154  return std::sort_heap(first, last, boost::bind(comp, _1, _2));
155 }
156 
162 template <class RandomAccessRange, class Compare>
163 inline void sort_heap(RandomAccessRange& range, Compare comp)
164 {
165  return adobe::sort_heap(boost::begin(range), boost::end(range), comp);
166 }
167 
168 /*************************************************************************************************/
169 
170 } // namespace adobe
171 
172 /*************************************************************************************************/
173 
174 #endif
175 
176 /*************************************************************************************************/

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