]>
Commit | Line | Data |
---|---|---|
4569a895 AT |
1 | // -*- C++ -*- |
2 | ||
f5886803 | 3 | // Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc. |
4569a895 AT |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the terms | |
7 | // of the GNU General Public License as published by the Free Software | |
748086b7 | 8 | // Foundation; either version 3, or (at your option) any later |
4569a895 AT |
9 | // version. |
10 | ||
11 | // This library is distributed in the hope that it will be useful, but | |
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | // General Public License for more details. | |
15 | ||
748086b7 JJ |
16 | // Under Section 7 of GPL version 3, you are granted additional |
17 | // permissions described in the GCC Runtime Library Exception, version | |
18 | // 3.1, as published by the Free Software Foundation. | |
19 | ||
20 | // You should have received a copy of the GNU General Public License and | |
21 | // a copy of the GCC Runtime Library Exception along with this program; | |
22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
23 | // <http://www.gnu.org/licenses/>. | |
4569a895 AT |
24 | |
25 | // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. | |
26 | ||
27 | // Permission to use, copy, modify, sell, and distribute this software | |
28 | // is hereby granted without fee, provided that the above copyright | |
29 | // notice appears in all copies, and that both that copyright notice | |
30 | // and this permission notice appear in supporting documentation. None | |
31 | // of the above authors, nor IBM Haifa Research Laboratories, make any | |
32 | // representation about the suitability of this software for any | |
33 | // purpose. It is provided "as is" without express or implied | |
34 | // warranty. | |
35 | ||
36 | /** | |
37 | * @file binomial_heap_.hpp | |
38 | * Contains an implementation class for a binomial heap. | |
39 | */ | |
40 | ||
41 | /* | |
42 | * Binomial heap. | |
43 | * Vuillemin J is the mastah. | |
44 | * Modified from CLRS. | |
45 | */ | |
46 | ||
47bea7b8 | 47 | #include <debug/debug.h> |
4569a895 AT |
48 | #include <ext/pb_ds/detail/cond_dealtor.hpp> |
49 | #include <ext/pb_ds/detail/type_utils.hpp> | |
50 | #include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp> | |
51 | ||
5e11f978 | 52 | namespace __gnu_pbds |
4569a895 AT |
53 | { |
54 | namespace detail | |
55 | { | |
56 | ||
47bea7b8 | 57 | #define PB_DS_CLASS_T_DEC \ |
4569a895 AT |
58 | template<typename Value_Type, class Cmp_Fn, class Allocator> |
59 | ||
47bea7b8 BK |
60 | #define PB_DS_CLASS_C_DEC \ |
61 | binomial_heap_<Value_Type, Cmp_Fn, Allocator> | |
4569a895 | 62 | |
47bea7b8 BK |
63 | #define PB_DS_BASE_C_DEC \ |
64 | binomial_heap_base_<Value_Type, Cmp_Fn, Allocator> | |
4569a895 AT |
65 | |
66 | /** | |
67 | * class description = "8y|\|0|\/|i41 h34p 74813"> | |
68 | **/ | |
69 | template<typename Value_Type, class Cmp_Fn, class Allocator> | |
70 | class binomial_heap_ : public PB_DS_BASE_C_DEC | |
71 | { | |
4569a895 AT |
72 | private: |
73 | typedef PB_DS_BASE_C_DEC base_type; | |
4569a895 | 74 | typedef typename base_type::node_pointer node_pointer; |
4569a895 AT |
75 | typedef typename base_type::const_node_pointer const_node_pointer; |
76 | ||
77 | public: | |
1b24692f | 78 | typedef Value_Type value_type; |
4569a895 | 79 | typedef typename Allocator::size_type size_type; |
4569a895 | 80 | typedef typename Allocator::difference_type difference_type; |
4569a895 | 81 | typedef typename base_type::pointer pointer; |
4569a895 | 82 | typedef typename base_type::const_pointer const_pointer; |
4569a895 | 83 | typedef typename base_type::reference reference; |
4569a895 | 84 | typedef typename base_type::const_reference const_reference; |
4569a895 | 85 | typedef typename base_type::const_point_iterator const_point_iterator; |
4569a895 | 86 | typedef typename base_type::point_iterator point_iterator; |
4569a895 | 87 | typedef typename base_type::const_iterator const_iterator; |
4569a895 | 88 | typedef typename base_type::iterator iterator; |
4569a895 | 89 | typedef typename base_type::cmp_fn cmp_fn; |
b67758fe | 90 | typedef typename base_type::allocator_type allocator_type; |
4569a895 | 91 | |
4569a895 AT |
92 | binomial_heap_(); |
93 | ||
94 | binomial_heap_(const Cmp_Fn& r_cmp_fn); | |
95 | ||
96 | binomial_heap_(const PB_DS_CLASS_C_DEC& other); | |
97 | ||
98 | ~binomial_heap_(); | |
99 | ||
100 | protected: | |
47bea7b8 | 101 | #ifdef _GLIBCXX_DEBUG |
4569a895 | 102 | void |
f5886803 | 103 | assert_valid(const char* file, int line) const; |
47bea7b8 | 104 | #endif |
4569a895 AT |
105 | }; |
106 | ||
107 | #include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp> | |
108 | #include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp> | |
109 | ||
110 | #undef PB_DS_CLASS_C_DEC | |
111 | ||
112 | #undef PB_DS_CLASS_T_DEC | |
113 | ||
114 | #undef PB_DS_BASE_C_DEC | |
4569a895 | 115 | } // namespace detail |
5e11f978 | 116 | } // namespace __gnu_pbds |