Go to the documentation of this file.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 #ifndef PB_DS_PRIORITY_QUEUE_HPP
00042 #define PB_DS_PRIORITY_QUEUE_HPP
00043
00044 #include <bits/c++config.h>
00045 #include <ext/pb_ds/tag_and_trait.hpp>
00046 #include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp>
00047 #include <ext/pb_ds/detail/standard_policies.hpp>
00048
00049 namespace __gnu_pbds
00050 {
00051
00052 template<typename Value_Type,
00053 typename Cmp_Fn = std::less<Value_Type>,
00054 typename Tag = pairing_heap_tag,
00055 typename Allocator = std::allocator<char> >
00056 class priority_queue
00057 : public detail::priority_queue_base_dispatch<Value_Type,
00058 Cmp_Fn,Tag,Allocator>::type
00059 {
00060 private:
00061 typedef typename
00062 detail::priority_queue_base_dispatch<Value_Type, Cmp_Fn,
00063 Tag, Allocator>::type base_type;
00064
00065 public:
00066 typedef Value_Type value_type;
00067 typedef Cmp_Fn cmp_fn;
00068 typedef Tag container_category;
00069 typedef Allocator allocator_type;
00070 typedef typename allocator_type::size_type size_type;
00071 typedef typename allocator_type::difference_type difference_type;
00072
00073 typedef typename allocator_type::template rebind<value_type>::other value_rebind;
00074 typedef typename value_rebind::reference reference;
00075 typedef typename value_rebind::const_reference const_reference;
00076 typedef typename value_rebind::pointer pointer;
00077 typedef typename value_rebind::const_pointer const_pointer;
00078
00079 typedef typename base_type::const_point_iterator const_point_iterator;
00080 typedef typename base_type::point_iterator point_iterator;
00081 typedef typename base_type::const_iterator const_iterator;
00082 typedef typename base_type::iterator iterator;
00083
00084 priority_queue() { }
00085
00086
00087
00088 priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { }
00089
00090
00091
00092
00093 template<typename It>
00094 priority_queue(It first_it, It last_it)
00095 { base_type::copy_from_range(first_it, last_it); }
00096
00097
00098
00099
00100
00101 template<typename It>
00102 priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn)
00103 : base_type(r_cmp_fn)
00104 { base_type::copy_from_range(first_it, last_it); }
00105
00106 priority_queue(const priority_queue& other)
00107 : base_type((const base_type& )other) { }
00108
00109 virtual
00110 ~priority_queue() { }
00111
00112 priority_queue&
00113 operator=(const priority_queue& other)
00114 {
00115 if (this != &other)
00116 {
00117 priority_queue tmp(other);
00118 swap(tmp);
00119 }
00120 return *this;
00121 }
00122
00123 void
00124 swap(priority_queue& other)
00125 { base_type::swap(other); }
00126 };
00127 }
00128
00129 #endif