#include "qtextstream.h"
#include "qstring.h"
Go to the source code of this file.
|
template<class InputIterator , class OutputIterator > |
OutputIterator | qCopy (InputIterator _begin, InputIterator _end, OutputIterator _dest) |
|
template<class T > |
void | qSwap (T &_value1, T &_value2) |
|
template<class InputIterator > |
void | qBubbleSort (InputIterator b, InputIterator e) |
|
template<class Container > |
void | qBubbleSort (Container &c) |
|
template<class Value > |
void | qHeapSortPushDown (Value *heap, int first, int last) |
|
template<class InputIterator , class Value > |
void | qHeapSortHelper (InputIterator b, InputIterator e, Value, uint n) |
|
template<class InputIterator > |
void | qHeapSort (InputIterator b, InputIterator e) |
|
template<class Container > |
void | qHeapSort (Container &c) |
|
template<class InputIterator >
void qBubbleSort |
( |
InputIterator |
b, |
|
|
InputIterator |
e |
|
) |
| |
|
inline |
Definition at line 89 of file qtl.h.
92 InputIterator last =
e;
100 bool swapped =
FALSE;
101 InputIterator swap_pos =
b;
void qSwap(T &_value1, T &_value2)
template<class Container >
void qBubbleSort |
( |
Container & |
c | ) |
|
|
inline |
Definition at line 123 of file qtl.h.
void qBubbleSort(InputIterator b, InputIterator e)
template<class InputIterator , class OutputIterator >
OutputIterator qCopy |
( |
InputIterator |
_begin, |
|
|
InputIterator |
_end, |
|
|
OutputIterator |
_dest |
|
) |
| |
|
inline |
Definition at line 70 of file qtl.h.
73 while( _begin != _end )
template<class InputIterator >
void qHeapSort |
( |
InputIterator |
b, |
|
|
InputIterator |
e |
|
) |
| |
|
inline |
Definition at line 192 of file qtl.h.
199 InputIterator it =
b;
void qHeapSortHelper(InputIterator b, InputIterator e, Value, uint n)
template<class Container >
void qHeapSort |
( |
Container & |
c | ) |
|
|
inline |
Definition at line 213 of file qtl.h.
void qHeapSortHelper(InputIterator b, InputIterator e, Value, uint n)
template<class InputIterator , class Value >
void qHeapSortHelper |
( |
InputIterator |
b, |
|
|
InputIterator |
e, |
|
|
Value |
, |
|
|
uint |
n |
|
) |
| |
|
inline |
Definition at line 161 of file qtl.h.
164 InputIterator insert =
b;
165 Value* realheap =
new Value[
n ];
167 Value* heap = realheap - 1;
169 for( ; insert !=
e; ++insert ) {
170 heap[++
size] = *insert;
172 while( i > 1 && heap[i] < heap[ i / 2 ] ) {
173 qSwap( heap[i], heap[ i / 2 ] );
179 for(
uint i =
n; i > 0; i-- ) {
void qSwap(T &_value1, T &_value2)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
void qHeapSortPushDown(Value *heap, int first, int last)
template<class Value >
void qHeapSortPushDown |
( |
Value * |
heap, |
|
|
int |
first, |
|
|
int |
last |
|
) |
| |
|
inline |
Definition at line 130 of file qtl.h.
133 while( r <= last/2 ) {
137 if ( heap[r] > heap[ 2*r ] )
138 qSwap( heap[r], heap[ 2*r ] );
142 if ( heap[r] > heap[ 2*r ] && heap[ 2*r ] <= heap[ 2*r+1 ] ) {
144 qSwap( heap[r], heap[ 2*r ] );
146 }
else if ( heap[r] > heap[ 2*r+1 ] &&
147 heap[ 2*r+1 ] < heap[ 2*r ] ) {
149 qSwap( heap[r], heap[ 2*r+1 ] );
void qSwap(T &_value1, T &_value2)
template<class T >
void qSwap |
( |
T & |
_value1, |
|
|
T & |
_value2 |
|
) |
| |
|
inline |
Definition at line 80 of file qtl.h.