priority_queue.cpp

来自「Data Abstraction & Problem Solving with 」· C++ 代码 · 共 47 行

CPP
47
字号
template <class T, class Container = vector<T>,          class Compare = less<typename Container::value_type> >class priority_queuepublic:   explicit priority_queue(const Compare& = Compare(),                           const Container& = Container()) ;   // Default constructor; initializes an empty priority queue.   // The default comparison operator is <.    // A comparison function object may be supplied.    // Precondition: None.   // Postcondition: An empty priority queue exists.   bool empty() const;   // Determines whether the priority queue is empty.   // Precondition: None.   // Postcondition: Returns true if the priority queue is empty,   // otherwise returns false.    size_type size() const;   // Determines the size of the priority queue.   // The return type size_type is an integral type.    // Precondition: None.   // Postcondition: Returns the number of items that   // are currently in the priority queue.   const value_type& top() const;   // Returns a reference to the highest priority element in the   // priority queue.   // Precondition: None.   // Postcondition: The item remains at the top of the    // priority queue.   void pop();   // Removes the highest priority element in the   // priority queue   // Precondition: None.   // Postcondition: The priority queue has the highest priority   // element at the top.      void push(const value_type& e);   // Adds the item e to the priority queue   // Precondition: None.   // Postcondition: The priority queue has the highest priority   // element at the top.}  // end STL priority_queue 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?