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