Templates -- Meow  1.1.4
A C++ template which is unable and also not allowed to compile to obj-file first.
meow::MergeableHeap< Element > Class Template Reference

一個用 左偏樹 實作的 Maximum-Heap , 除了原本heap有的功能外, 還支援 merge 功能 More...

#include "MergeableHeap.h"

Public Member Functions

 MergeableHeap ()
 constructor More...
 
 MergeableHeap (MergeableHeap const &heap2)
 constructor, 並且複製資料 More...
 
 ~MergeableHeap ()
 destructor More...
 
MergeableHeapcopyFrom (MergeableHeap const &heap2)
 複製資料 More...
 
void moveTo (MergeableHeap *heap2)
 將自己的資料丟給指定的heap, 從此自己一身空 More...
 
Element const & top () const
 回傳最大的那個 Element More...
 
size_t size () const
 回傳資料個數 More...
 
bool empty () const
 回傳是否為空 More...
 
void push (Element const &value)
 加入element More...
 
void pop ()
 將最大的element移除 More...
 
void clear ()
 
void merge (MergeableHeap *heap2)
 
MergeableHeapoperator= (MergeableHeap const &heap2)
 same as copyFrom(heap2) More...
 

Detailed Description

template<class Element>
class meow::MergeableHeap< Element >

一個用 左偏樹 實作的 Maximum-Heap , 除了原本heap有的功能外, 還支援 merge 功能

Template Class Operators Request

const?TypenameOperator Parameters Return Type Description
const Element operator< (Element b)bool 大小比較
Note
: 假設現在有兩個MergeableHeap AB, 則:
  • 執行 A.merge(&B)B 會變成空的
  • 執行 B.moveTo(&A)B 會變成空的, A 原本擁有的資料也會覆蓋掉
Author
cat_leopard

Definition at line 30 of file MergeableHeap.h.

Constructor & Destructor Documentation

template<class Element >
meow::MergeableHeap< Element >::MergeableHeap ( )
inline

constructor

Definition at line 78 of file MergeableHeap.h.

template<class Element >
meow::MergeableHeap< Element >::MergeableHeap ( MergeableHeap< Element > const &  heap2)
inline

constructor, 並且複製資料

Definition at line 82 of file MergeableHeap.h.

template<class Element >
meow::MergeableHeap< Element >::~MergeableHeap ( )
inline

destructor

Definition at line 86 of file MergeableHeap.h.

Member Function Documentation

template<class Element >
void meow::MergeableHeap< Element >::clear ( )
inline

將資料清空

Definition at line 147 of file MergeableHeap.h.

template<class Element >
MergeableHeap& meow::MergeableHeap< Element >::copyFrom ( MergeableHeap< Element > const &  heap2)
inline

複製資料

Definition at line 91 of file MergeableHeap.h.

template<class Element >
bool meow::MergeableHeap< Element >::empty ( ) const
inline

回傳是否為空

Definition at line 123 of file MergeableHeap.h.

template<class Element >
void meow::MergeableHeap< Element >::merge ( MergeableHeap< Element > *  heap2)
inline

將給定的MergeableHeap的資料統統加到自己身上並且清空該heap

Definition at line 155 of file MergeableHeap.h.

template<class Element >
void meow::MergeableHeap< Element >::moveTo ( MergeableHeap< Element > *  heap2)
inline

將自己的資料丟給指定的heap, 從此自己一身空

Definition at line 100 of file MergeableHeap.h.

template<class Element >
MergeableHeap& meow::MergeableHeap< Element >::operator= ( MergeableHeap< Element > const &  heap2)
inline

same as copyFrom(heap2)

Definition at line 161 of file MergeableHeap.h.

template<class Element >
void meow::MergeableHeap< Element >::pop ( )
inline

將最大的element移除

Definition at line 137 of file MergeableHeap.h.

template<class Element >
void meow::MergeableHeap< Element >::push ( Element const &  value)
inline

加入element

Definition at line 130 of file MergeableHeap.h.

template<class Element >
size_t meow::MergeableHeap< Element >::size ( ) const
inline

回傳資料個數

Definition at line 116 of file MergeableHeap.h.

template<class Element >
Element const& meow::MergeableHeap< Element >::top ( ) const
inline

回傳最大的那個 Element

Definition at line 109 of file MergeableHeap.h.


The documentation for this class was generated from the following file: