stlab.adobe.com Adobe Systems Incorporated

heap.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_HEAP_HPP
00010 #define ADOBE_ALGORITHM_HEAP_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 /*************************************************************************************************/
00035 /*************************************************************************************************/
00041 template <class RandomAccessRange>
00042 inline void push_heap(RandomAccessRange& range)
00043 {
00044     return std::push_heap(boost::begin(range), boost::end(range));
00045 }
00046 
00052 template <class RandomAccessIterator, class Compare>
00053 inline void push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
00054 {
00055     return std::push_heap(first, last, boost::bind(comp, _1, _2));
00056 }
00057 
00063 template <class RandomAccessRange, class Compare>
00064 inline void push_heap(RandomAccessRange& range, Compare comp)
00065 {
00066     return adobe::push_heap(boost::begin(range), boost::end(range), comp);
00067 }
00068 
00074 template <class RandomAccessRange>
00075 inline void pop_heap(RandomAccessRange& range)
00076 {
00077     return std::pop_heap(boost::begin(range), boost::end(range));
00078 }
00079 
00085 template <class RandomAccessIterator, class Compare>
00086 inline void pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
00087 {
00088     return std::pop_heap(first, last, boost::bind(comp, _1, _2));
00089 }
00090 
00096 template <class RandomAccessRange, class Compare>
00097 inline void pop_heap(RandomAccessRange& range, Compare comp)
00098 {
00099     return adobe::pop_heap(boost::begin(range), boost::end(range), comp);
00100 }
00101 
00107 template <class RandomAccessRange>
00108 inline void make_heap(RandomAccessRange& range)
00109 {
00110     return std::make_heap(boost::begin(range), boost::end(range));
00111 }
00112 
00118 template <class RandomAccessIterator, class Compare>
00119 inline void make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
00120 {
00121     return std::make_heap(first, last, boost::bind(comp, _1, _2));
00122 }
00123 
00129 template <class RandomAccessRange, class Compare>
00130 inline void make_heap(RandomAccessRange& range, Compare comp)
00131 {
00132     return adobe::make_heap(boost::begin(range), boost::end(range), comp);
00133 }
00134 
00140 template <class RandomAccessRange>
00141 inline void sort_heap(RandomAccessRange& range)
00142 {
00143     return std::sort_heap(boost::begin(range), boost::end(range));
00144 }
00145 
00151 template <class RandomAccessIterator, class Compare>
00152 inline void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
00153 {
00154     return std::sort_heap(first, last, boost::bind(comp, _1, _2));
00155 }
00156 
00162 template <class RandomAccessRange, class Compare>
00163 inline void sort_heap(RandomAccessRange& range, Compare comp)
00164 {
00165     return adobe::sort_heap(boost::begin(range), boost::end(range), comp);
00166 }
00167 
00168 /*************************************************************************************************/
00169 
00170 } // namespace adobe
00171 
00172 /*************************************************************************************************/
00173 
00174 #endif
00175 
00176 /*************************************************************************************************/

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