45 #ifndef QT_NO_TEXTSTREAM 56 : stream( s ), separator( sep ) {}
67 #endif //QT_NO_TEXTSTREAM 69 template <
class InputIterator,
class OutputIterator>
70 inline OutputIterator
qCopy( InputIterator _begin, InputIterator _end,
71 OutputIterator _dest )
73 while( _begin != _end )
80 inline void qSwap(
T& _value1,
T& _value2 )
88 template <
class InputIterator>
92 InputIterator last =
e;
100 bool swapped =
FALSE;
101 InputIterator swap_pos =
b;
122 template <
class Container>
129 template <
class Value>
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 ] );
160 template <
class InputIterator,
class Value>
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-- ) {
191 template <
class InputIterator>
199 InputIterator it =
b;
212 template <
class Container>
QTextOStreamIterator(QTextOStream &s, const QString &sep)
void qHeapSortHelper(InputIterator b, InputIterator e, Value, uint n)
QTextOStreamIterator< T > & operator*()
QTextOStreamIterator< T > & operator++()
OutputIterator qCopy(InputIterator _begin, InputIterator _end, OutputIterator _dest)
void qSwap(T &_value1, T &_value2)
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
QTextOStreamIterator(QTextOStream &s)
void qBubbleSort(InputIterator b, InputIterator e)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
QTextOStreamIterator< T > & operator++(int)
void qHeapSort(InputIterator b, InputIterator e)
A convenience class for output streams.
void qHeapSortPushDown(Value *heap, int first, int last)
QTextOStreamIterator< T > & operator=(const T &x)