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