# stl_heap.h File Reference

## Detailed Description

This is an internal header file, included by other library headers. You should not attempt to use it directly.

Definition in file stl_heap.h.

Go to the source code of this file.

## Namespaces

- namespace std

## Defines

- #define _STL_HEAP_H

## Functions

- template<typename _RandomAccessIterator, typename _Distance, typename _Tp, typename _Compare> void __adjust_heap (_RandomAccessIterator __first, _Distance __holeIndex, _Distance __len, _Tp __value, _Compare __comp)
- template<typename _RandomAccessIterator, typename _Distance, typename _Tp> void __adjust_heap (_RandomAccessIterator __first, _Distance __holeIndex, _Distance __len, _Tp __value)
- template<typename _RandomAccessIterator, typename _StrictWeakOrdering> bool __is_heap (_RandomAccessIterator __first, _RandomAccessIterator __last, _StrictWeakOrdering __comp)
- template<typename _RandomAccessIterator> bool __is_heap (_RandomAccessIterator __first, _RandomAccessIterator __last)
- template<typename _RandomAccessIterator, typename _Distance, typename _StrictWeakOrdering> bool __is_heap (_RandomAccessIterator __first, _StrictWeakOrdering __comp, _Distance __n)
- template<typename _RandomAccessIterator, typename _Distance> bool __is_heap (_RandomAccessIterator __first, _Distance __n)
- template<typename _RandomAccessIterator, typename _Tp, typename _Compare> void __pop_heap (_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomAccessIterator __result, _Tp __value, _Compare __comp)
- template<typename _RandomAccessIterator, typename _Tp> void __pop_heap (_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomAccessIterator __result, _Tp __value)
- template<typename _RandomAccessIterator, typename _Distance, typename _Tp, typename _Compare> void __push_heap (_RandomAccessIterator __first, _Distance __holeIndex, _Distance __topIndex, _Tp __value, _Compare __comp)
- template<typename _RandomAccessIterator, typename _Distance, typename _Tp> void __push_heap (_RandomAccessIterator __first, _Distance __holeIndex, _Distance __topIndex, _Tp __value)
- template<typename _RandomAccessIterator, typename _Compare> void make_heap (_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
- template<typename _RandomAccessIterator> void make_heap (_RandomAccessIterator __first, _RandomAccessIterator __last)
- template<typename _RandomAccessIterator, typename _Compare> void pop_heap (_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
- template<typename _RandomAccessIterator> void pop_heap (_RandomAccessIterator __first, _RandomAccessIterator __last)
- template<typename _RandomAccessIterator, typename _Compare> void push_heap (_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
- template<typename _RandomAccessIterator> void push_heap (_RandomAccessIterator __first, _RandomAccessIterator __last)
- template<typename _RandomAccessIterator, typename _Compare> void sort_heap (_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
- template<typename _RandomAccessIterator> void sort_heap (_RandomAccessIterator __first, _RandomAccessIterator __last)

## Function Documentation

void std::make_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last,
|  | _Compare | __comp
| ) | `[inline]`

Construct a heap over a range using comparison functor.

Parameters:

  | first | Start of heap.
  | last | End of heap.
  | comp | Comparison functor to use.

This operation makes the elements in [first,last) into a heap. Comparisons are made using comp.

Definition at line 384 of file stl_heap.h.

void std::make_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last
| ) |

Construct a heap over a range.

Parameters:

  | first | Start of heap.
  | last | End of heap.

This operation makes the elements in [first,last) into a heap.

Definition at line 344 of file stl_heap.h.

Referenced by std::partial_sort(), std::partial_sort_copy(), and priority_queue::priority_queue().

void std::pop_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last,
|  | _Compare | __comp
| ) | `[inline]`

Pop an element off a heap using comparison functor.

Parameters:

  | first | Start of heap.
  | last | End of heap.
  | comp | Comparison functor to use.

This operation pops the top of the heap. The elements first and last-1 are swapped and [first,last-1) is made into a heap. Comparisons are made using comp.

Definition at line 319 of file stl_heap.h.

void std::pop_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last
| ) | `[inline]`

Pop an element off a heap.

Parameters:

  | first | Start of heap.
  | last | End of heap.

This operation pops the top of the heap. The elements first and last-1 are swapped and [first,last-1) is made into a heap.

Definition at line 253 of file stl_heap.h.

Referenced by priority_queue::pop(), and std::sort_heap().

void std::push_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last,
|  | _Compare | __comp
| ) | `[inline]`

Push an element onto a heap using comparison functor.

Parameters:

  | first | Start of heap.
  | last | End of heap + element.
  | comp | Comparison functor.

This operation pushes the element at last-1 onto the valid heap over the range [first,last-1). After completion, [first,last) is a valid heap. Compare operations are performed using comp.

Definition at line 189 of file stl_heap.h.

void std::push_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last
| ) | `[inline]`

Push an element onto a heap.

Parameters:

  | first | Start of heap.
  | last | End of heap + element.

This operation pushes the element at last-1 onto the valid heap over the range [first,last-1). After completion, [first,last) is a valid heap.

Definition at line 141 of file stl_heap.h.

Referenced by priority_queue::push().

void std::sort_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last,
|  | _Compare | __comp
| ) |

Sort a heap using comparison functor.

Parameters:

  | first | Start of heap.
  | last | End of heap.
  | comp | Comparison functor to use.

This operation sorts the valid heap in the range [first,last). Comparisons are made using comp.

Definition at line 448 of file stl_heap.h.

References std::pop_heap().

void std::sort_heap | ( | _RandomAccessIterator | __first,
|  | _RandomAccessIterator | __last
| ) |

Sort a heap.

Parameters:

  | first | Start of heap.
  | last | End of heap.

This operation sorts the valid heap in the range [first,last).

Definition at line 422 of file stl_heap.h.

References std::pop_heap().

Referenced by std::partial_sort(), and std::partial_sort_copy().