Tapkee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
reservable_priority_queue.hpp
Go to the documentation of this file.
1 #ifndef RESERVABLE_PRIORITY_QUEUE_H_
2 #define RESERVABLE_PRIORITY_QUEUE_H_
3 
4 #include <queue>
5 #include <vector>
6 
7 namespace tapkee
8 {
9 namespace tapkee_internal
10 {
11 
12 //#pragma GCC diagnostic ignored "-Weffc++"
13 template <class T, class Comparator>
14 class reservable_priority_queue: public std::priority_queue<T,std::vector<T>,Comparator>
15 {
16 public:
17  typedef typename std::priority_queue<T>::size_type size_type;
18  reservable_priority_queue(size_type initial_capacity=0)
19  {
20  reserve(initial_capacity);
21  }
22  void reserve(size_type initial_capacity)
23  {
24  this->c.reserve(initial_capacity);
25  }
27  {
28  return this->c.capacity();
29  }
30  void clear()
31  {
32  this->c.clear();
33  }
34 };
35 //#pragma GCC diagnostic pop
36 
37 } /* End of namespace tapkee_internal */
38 } /* End of namespace tapkee */
39 
40 #endif