libstdc++
|
00001 // -*- C++ -*- 00002 00003 // Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the terms 00007 // of the GNU General Public License as published by the Free Software 00008 // Foundation; either version 3, or (at your option) any later 00009 // version. 00010 00011 // This library is distributed in the hope that it will be useful, but 00012 // WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 00026 00027 // Permission to use, copy, modify, sell, and distribute this software 00028 // is hereby granted without fee, provided that the above copyright 00029 // notice appears in all copies, and that both that copyright notice 00030 // and this permission notice appear in supporting documentation. None 00031 // of the above authors, nor IBM Haifa Research Laboratories, make any 00032 // representation about the suitability of this software for any 00033 // purpose. It is provided "as is" without express or implied 00034 // warranty. 00035 00036 /** 00037 * @file binomial_heap_.hpp 00038 * Contains an implementation class for a binomial heap. 00039 */ 00040 00041 /* 00042 * Binomial heap. 00043 * Vuillemin J is the mastah. 00044 * Modified from CLRS. 00045 */ 00046 00047 #include <debug/debug.h> 00048 #include <ext/pb_ds/detail/cond_dealtor.hpp> 00049 #include <ext/pb_ds/detail/type_utils.hpp> 00050 #include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp> 00051 00052 namespace __gnu_pbds 00053 { 00054 namespace detail 00055 { 00056 #define PB_DS_CLASS_T_DEC \ 00057 template<typename Value_Type, typename Cmp_Fn, typename _Alloc> 00058 00059 #define PB_DS_CLASS_C_DEC \ 00060 binomial_heap<Value_Type, Cmp_Fn, _Alloc> 00061 00062 /** 00063 * Binomial heap. 00064 * 00065 * @ingroup heap-detail 00066 */ 00067 template<typename Value_Type, typename Cmp_Fn, typename _Alloc> 00068 class binomial_heap 00069 : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> 00070 { 00071 private: 00072 typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> base_type; 00073 typedef typename base_type::node_pointer node_pointer; 00074 typedef typename base_type::node_const_pointer node_const_pointer; 00075 00076 public: 00077 typedef Value_Type value_type; 00078 typedef typename _Alloc::size_type size_type; 00079 typedef typename _Alloc::difference_type difference_type; 00080 typedef typename base_type::pointer pointer; 00081 typedef typename base_type::const_pointer const_pointer; 00082 typedef typename base_type::reference reference; 00083 typedef typename base_type::const_reference const_reference; 00084 typedef typename base_type::point_const_iterator point_const_iterator; 00085 typedef typename base_type::point_iterator point_iterator; 00086 typedef typename base_type::const_iterator const_iterator; 00087 typedef typename base_type::iterator iterator; 00088 typedef typename base_type::cmp_fn cmp_fn; 00089 typedef typename base_type::allocator_type allocator_type; 00090 00091 binomial_heap(); 00092 00093 binomial_heap(const Cmp_Fn&); 00094 00095 binomial_heap(const binomial_heap&); 00096 00097 ~binomial_heap(); 00098 00099 protected: 00100 #ifdef _GLIBCXX_DEBUG 00101 void 00102 assert_valid(const char*, int) const; 00103 #endif 00104 }; 00105 00106 #include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp> 00107 #include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp> 00108 00109 #undef PB_DS_CLASS_C_DEC 00110 #undef PB_DS_CLASS_T_DEC 00111 } // namespace detail 00112 } // namespace __gnu_pbds