]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/graph/include/boost/pending/is_heap.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / graph / include / boost / pending / is_heap.hpp
CommitLineData
7c673cae
FG
1//
2//=======================================================================
3// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
4// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
5//
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//=======================================================================
10//
11#if __KCC
12namespace std {
13
14template <class RandomAccessIterator, class Distance>
15bool __is_heap(RandomAccessIterator first, RandomAccessIterator last,
16 Distance*)
17{
18 const Distance n = last - first;
19
20 Distance parent = 0;
21 for (Distance child = 1; child < n; ++child) {
22 if (first[parent] < first[child])
23 return false;
24 if ((child & 1) == 0)
25 ++parent;
26 }
27 return true;
28}
29
30template <class RandomAccessIterator>
31inline bool is_heap(RandomAccessIterator first, RandomAccessIterator last)
32{
33 return __is_heap(first, last, distance_type(first));
34}
35
36
37template <class RandomAccessIterator, class Distance, class StrictWeakOrdering>
38bool __is_heap(RandomAccessIterator first, RandomAccessIterator last,
39 StrictWeakOrdering comp,
40 Distance*)
41{
42 const Distance n = last - first;
43
44 Distance parent = 0;
45 for (Distance child = 1; child < n; ++child) {
46 if (comp(first[parent], first[child]))
47 return false;
48 if ((child & 1) == 0)
49 ++parent;
50 }
51 return true;
52}
53
54template <class RandomAccessIterator, class StrictWeakOrdering>
55inline bool is_heap(RandomAccessIterator first, RandomAccessIterator last,
56 StrictWeakOrdering comp)
57{
58 return __is_heap(first, last, comp, distance_type(first));
59}
60
61}
62#endif