Пример #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
 const_iterator end() const { return c.end(); }
Пример #4
0
 iterator begin() { return c.begin(); }
Пример #5
0
 const_iterator begin() const { return c.begin(); }
Пример #6
0
 void make_heap()
 {
   std::make_heap(c.begin(), c.end(), static_cast<_Compare&>(*this));
 }
Пример #7
0
 void push_back(const value_type& x)
 {
   c.push_back(x);
 }
Пример #8
0
 void pop()
 {
   std::pop_heap(c.begin(), c.end(), static_cast<_Compare&>(*this));
   c.pop_back();
 }
Пример #9
0
 // a conventional interface...
 const_reference top()
 {
   return c.front();
 }
Пример #10
0
 void reserve(size_type x) { c.reserve(x); }
Пример #11
0
 void clear() { c.clear(); }
Пример #12
0
 size_type size() const { return c.size(); }
Пример #13
0
 bool empty() const { return c.empty(); }
Пример #14
0
    void pop() {
	pop_heap(c.begin(), c.end(), comp);
	c.pop_back();
    }
Пример #15
0
    void push(const value_type& __x) {
	c.push_back(__x);
	push_heap(c.begin(), c.end(), comp);
    }
Пример #16
0
 iterator end() { return c.end(); }
Пример #17
0
 void swap(std_heap& x)
 {
   std::swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(x));
   c.swap(x.c);
 }
Пример #18
0
 void push(const value_type& x)
 {
   c.push_back(x);
   std::push_heap(c.begin(), c.end(), static_cast<_Compare&>(*this));
 }