2 //=======================================================================
3 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
4 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
6 // Distributed under the Boost Software License, Version 1.0. (See
7 // accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 //=======================================================================
14 template <class RandomAccessIterator
, class Distance
>
15 bool __is_heap(RandomAccessIterator first
, RandomAccessIterator last
,
18 const Distance n
= last
- first
;
21 for (Distance child
= 1; child
< n
; ++child
) {
22 if (first
[parent
] < first
[child
])
30 template <class RandomAccessIterator
>
31 inline bool is_heap(RandomAccessIterator first
, RandomAccessIterator last
)
33 return __is_heap(first
, last
, distance_type(first
));
37 template <class RandomAccessIterator
, class Distance
, class StrictWeakOrdering
>
38 bool __is_heap(RandomAccessIterator first
, RandomAccessIterator last
,
39 StrictWeakOrdering comp
,
42 const Distance n
= last
- first
;
45 for (Distance child
= 1; child
< n
; ++child
) {
46 if (comp(first
[parent
], first
[child
]))
54 template <class RandomAccessIterator
, class StrictWeakOrdering
>
55 inline bool is_heap(RandomAccessIterator first
, RandomAccessIterator last
,
56 StrictWeakOrdering comp
)
58 return __is_heap(first
, last
, comp
, distance_type(first
));