Пример #1
0
    explicit PriorityQueue(const _Compare& __comp = _Compare(),
			   const _Sequence& __s = _Sequence(),
			   const _Map& __m = _Map())
    : c(__s), m(__m), comp(__comp) 
    { 
	make_heap(c.begin(), c.end(), comp); 
    }
Пример #2
0
    PriorityQueue(_InputIterator __first, _InputIterator __last,
		  const _Compare& __comp = _Compare(), 
		  const _Sequence& __s = _Sequence(),
		  const _Map& __m = _Map()) 
    : c(__s), m(__m), comp(__comp) 
    {
	c.insert(c.end(), __first, __last);
	make_heap(c.begin(), c.end(), comp);
    }
Пример #3
0
 iterator begin() { return c.begin(); }
Пример #4
0
 const_iterator begin() const { return c.begin(); }
Пример #5
0
 void make_heap()
 {
   std::make_heap(c.begin(), c.end(), static_cast<_Compare&>(*this));
 }
Пример #6
0
 void pop()
 {
   std::pop_heap(c.begin(), c.end(), static_cast<_Compare&>(*this));
   c.pop_back();
 }
Пример #7
0
 void push(const value_type& x)
 {
   c.push_back(x);
   std::push_heap(c.begin(), c.end(), static_cast<_Compare&>(*this));
 }
Пример #8
0
    void pop() {
	pop_heap(c.begin(), c.end(), comp);
	c.pop_back();
    }
Пример #9
0
    void push(const value_type& __x) {
	c.push_back(__x);
	push_heap(c.begin(), c.end(), comp);
    }