Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
heap.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_HEAP_HPP
9#define ADOBE_ALGORITHM_HEAP_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15
16#include <algorithm>
17#include <functional>
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
34/**************************************************************************************************/
40template <class RandomAccessRange>
41inline void push_heap(RandomAccessRange& range) {
42 return std::push_heap(boost::begin(range), boost::end(range));
43}
44
50template <class RandomAccessIterator, class Compare>
51inline void push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp) {
52 return std::push_heap(first, last,
53 std::bind(comp, std::placeholders::_1, std::placeholders::_2));
54}
55
61template <class RandomAccessRange, class Compare>
62inline void push_heap(RandomAccessRange& range, Compare comp) {
63 return adobe::push_heap(boost::begin(range), boost::end(range), comp);
64}
65
71template <class RandomAccessRange>
72inline void pop_heap(RandomAccessRange& range) {
73 return std::pop_heap(boost::begin(range), boost::end(range));
74}
75
81template <class RandomAccessIterator, class Compare>
82inline void pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp) {
83 return std::pop_heap(first, last,
84 std::bind(comp, std::placeholders::_1, std::placeholders::_2));
85}
86
92template <class RandomAccessRange, class Compare>
93inline void pop_heap(RandomAccessRange& range, Compare comp) {
94 return adobe::pop_heap(boost::begin(range), boost::end(range), comp);
95}
96
102template <class RandomAccessRange>
103inline void make_heap(RandomAccessRange& range) {
104 return std::make_heap(boost::begin(range), boost::end(range));
105}
106
112template <class RandomAccessIterator, class Compare>
113inline void make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp) {
114 return std::make_heap(first, last,
115 std::bind(comp, std::placeholders::_1, std::placeholders::_2));
116}
117
123template <class RandomAccessRange, class Compare>
124inline void make_heap(RandomAccessRange& range, Compare comp) {
125 return adobe::make_heap(boost::begin(range), boost::end(range), comp);
126}
127
133template <class RandomAccessRange>
134inline void sort_heap(RandomAccessRange& range) {
135 return std::sort_heap(boost::begin(range), boost::end(range));
136}
137
143template <class RandomAccessIterator, class Compare>
144inline void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp) {
145 return std::sort_heap(first, last,
146 std::bind(comp, std::placeholders::_1, std::placeholders::_2));
147}
148
154template <class RandomAccessRange, class Compare>
155inline void sort_heap(RandomAccessRange& range, Compare comp) {
156 return adobe::sort_heap(boost::begin(range), boost::end(range), comp);
157}
158
159/**************************************************************************************************/
160
161} // namespace adobe
162
163/**************************************************************************************************/
164
165#endif
166
167/**************************************************************************************************/
void pop_heap(RandomAccessRange &range)
heap implementation
Definition heap.hpp:72
void sort_heap(RandomAccessRange &range)
heap implementation
Definition heap.hpp:134
void make_heap(RandomAccessRange &range)
heap implementation
Definition heap.hpp:103
void push_heap(RandomAccessRange &range)
heap implementation
Definition heap.hpp:41