00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef PB_DS_PRIORITY_QUEUE_HPP
00048 #define PB_DS_PRIORITY_QUEUE_HPP
00049
00050 #include <ext/pb_ds/tag_and_trait.hpp>
00051 #include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp>
00052 #include <ext/pb_ds/detail/standard_policies.hpp>
00053
00054 namespace pb_ds
00055 {
00056
00057 template<typename Value_Type,
00058 typename Cmp_Fn = std::less<Value_Type>,
00059 typename Tag = pairing_heap_tag,
00060 typename Allocator = std::allocator<char> >
00061 class priority_queue
00062 : public detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type
00063 {
00064 private:
00065 typedef typename detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type base_type;
00066
00067 public:
00068 typedef Value_Type value_type;
00069 typedef Cmp_Fn cmp_fn;
00070 typedef Tag container_category;
00071 typedef Allocator allocator;
00072 typedef typename allocator::size_type size_type;
00073 typedef typename allocator::difference_type difference_type;
00074
00075 typedef typename allocator::template rebind<value_type>::other value_rebind;
00076 typedef typename value_rebind::reference reference;
00077 typedef typename value_rebind::const_reference const_reference;
00078 typedef typename value_rebind::pointer pointer;
00079 typedef typename value_rebind::const_pointer const_pointer;
00080
00081 typedef typename base_type::const_point_iterator const_point_iterator;
00082 typedef typename base_type::point_iterator point_iterator;
00083 typedef typename base_type::const_iterator const_iterator;
00084 typedef typename base_type::iterator iterator;
00085
00086 priority_queue() { }
00087
00088
00089
00090 priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { }
00091
00092
00093
00094
00095 template<typename It>
00096 priority_queue(It first_it, It last_it)
00097 { base_type::copy_from_range(first_it, last_it); }
00098
00099
00100
00101
00102
00103 template<typename It>
00104 priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn)
00105 : base_type(r_cmp_fn)
00106 { base_type::copy_from_range(first_it, last_it); }
00107
00108 priority_queue(const priority_queue& other)
00109 : base_type((const base_type& )other) { }
00110
00111 virtual
00112 ~priority_queue() { }
00113
00114 priority_queue&
00115 operator=(const priority_queue& other)
00116 {
00117 if (this !=& other)
00118 {
00119 priority_queue tmp(other);
00120 swap(tmp);
00121 }
00122 return *this;
00123 }
00124
00125 void
00126 swap(priority_queue& other)
00127 { base_type::swap(other); }
00128 };
00129 }
00130
00131 #endif