1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/stlport/stl/_heap.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,125 @@
1.4 +/*
1.5 + *
1.6 + * Copyright (c) 1994
1.7 + * Hewlett-Packard Company
1.8 + *
1.9 + * Permission to use, copy, modify, distribute and sell this software
1.10 + * and its documentation for any purpose is hereby granted without fee,
1.11 + * provided that the above copyright notice appear in all copies and
1.12 + * that both that copyright notice and this permission notice appear
1.13 + * in supporting documentation. Hewlett-Packard Company makes no
1.14 + * representations about the suitability of this software for any
1.15 + * purpose. It is provided "as is" without express or implied warranty.
1.16 + *
1.17 + * Copyright (c) 1997
1.18 + * Silicon Graphics Computer Systems, Inc.
1.19 + *
1.20 + * Permission to use, copy, modify, distribute and sell this software
1.21 + * and its documentation for any purpose is hereby granted without fee,
1.22 + * provided that the above copyright notice appear in all copies and
1.23 + * that both that copyright notice and this permission notice appear
1.24 + * in supporting documentation. Silicon Graphics makes no
1.25 + * representations about the suitability of this software for any
1.26 + * purpose. It is provided "as is" without express or implied warranty.
1.27 + */
1.28 +
1.29 +/* NOTE: This is an internal header file, included by other STL headers.
1.30 + * You should not attempt to use it directly.
1.31 + */
1.32 +
1.33 +#ifndef _STLP_INTERNAL_HEAP_H
1.34 +#define _STLP_INTERNAL_HEAP_H
1.35 +
1.36 +_STLP_BEGIN_NAMESPACE
1.37 +
1.38 +// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
1.39 +
1.40 +template <class _RandomAccessIterator>
1.41 +void
1.42 +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last);
1.43 +
1.44 +
1.45 +template <class _RandomAccessIterator, class _Compare>
1.46 +void
1.47 +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
1.48 + _Compare __comp);
1.49 +
1.50 +template <class _RandomAccessIterator, class _Distance, class _Tp>
1.51 +void
1.52 +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
1.53 + _Distance __len, _Tp __val);
1.54 +
1.55 +template <class _RandomAccessIterator, class _Tp, class _Distance>
1.56 +inline void
1.57 +__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
1.58 + _RandomAccessIterator __result, _Tp __val, _Distance*)
1.59 +{
1.60 + *__result = *__first;
1.61 + __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __val);
1.62 +}
1.63 +
1.64 +template <class _RandomAccessIterator>
1.65 +void pop_heap(_RandomAccessIterator __first,
1.66 + _RandomAccessIterator __last);
1.67 +
1.68 +template <class _RandomAccessIterator, class _Distance,
1.69 + class _Tp, class _Compare>
1.70 +void
1.71 +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
1.72 + _Distance __len, _Tp __val, _Compare __comp);
1.73 +
1.74 +template <class _RandomAccessIterator, class _Tp, class _Compare,
1.75 + class _Distance>
1.76 +inline void
1.77 +__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
1.78 + _RandomAccessIterator __result, _Tp __val, _Compare __comp,
1.79 + _Distance*)
1.80 +{
1.81 + *__result = *__first;
1.82 + __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
1.83 + __val, __comp);
1.84 +}
1.85 +
1.86 +template <class _RandomAccessIterator, class _Compare>
1.87 +void
1.88 +pop_heap(_RandomAccessIterator __first,
1.89 + _RandomAccessIterator __last, _Compare __comp);
1.90 +
1.91 +template <class _RandomAccessIterator>
1.92 +void
1.93 +make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last);
1.94 +
1.95 +template <class _RandomAccessIterator, class _Compare>
1.96 +void
1.97 +make_heap(_RandomAccessIterator __first,
1.98 + _RandomAccessIterator __last, _Compare __comp);
1.99 +
1.100 +template <class _RandomAccessIterator>
1.101 +_STLP_INLINE_LOOP
1.102 +void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
1.103 +{
1.104 + while (__last - __first > 1)
1.105 + pop_heap(__first, __last--);
1.106 +}
1.107 +
1.108 +template <class _RandomAccessIterator, class _Compare>
1.109 +_STLP_INLINE_LOOP
1.110 +void
1.111 +sort_heap(_RandomAccessIterator __first,
1.112 + _RandomAccessIterator __last, _Compare __comp)
1.113 +{
1.114 + while (__last - __first > 1)
1.115 + pop_heap(__first, __last--, __comp);
1.116 +}
1.117 +
1.118 +_STLP_END_NAMESPACE
1.119 +
1.120 +# if !defined (_STLP_LINK_TIME_INSTANTIATION)
1.121 +# include <stl/_heap.c>
1.122 +# endif
1.123 +
1.124 +#endif /* _STLP_INTERNAL_HEAP_H */
1.125 +
1.126 +// Local Variables:
1.127 +// mode:C++
1.128 +// End: