Tapkee
reservable_priority_queue.hpp
Go to the documentation of this file.
00001 #ifndef RESERVABLE_PRIORITY_QUEUE_H_
00002 #define RESERVABLE_PRIORITY_QUEUE_H_
00003 
00004 #include <queue>
00005 #include <vector>
00006 
00007 namespace tapkee
00008 {
00009 namespace tapkee_internal
00010 {
00011 
00012 //#pragma GCC diagnostic ignored "-Weffc++"
00013 template <class T, class Comparator>
00014 class reservable_priority_queue: public std::priority_queue<T,std::vector<T>,Comparator>
00015 {
00016 public:
00017     typedef typename std::priority_queue<T>::size_type size_type;
00018     reservable_priority_queue(size_type initial_capacity=0) 
00019     {
00020         reserve(initial_capacity);
00021     }
00022     void reserve(size_type initial_capacity) 
00023     {
00024         this->c.reserve(initial_capacity);
00025     }
00026     size_type capacity() const
00027     {
00028         return this->c.capacity();
00029     }
00030     void clear()
00031     {
00032         this->c.clear();
00033     }
00034 };
00035 //#pragma GCC diagnostic pop
00036 
00037 } /* End of namespace tapkee_internal */
00038 } /* End of namespace tapkee */
00039 
00040 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines