Templates -- Meow  1.1.2
不能,也不應該先編譯成obj-file的templates
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

Constructor & Destructor Documentation

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

constructor

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

constructor, 並且複製資料

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

destructor

Member Function Documentation

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

將資料清空

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

複製資料

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

回傳是否為空

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

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

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

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

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

same as copyFrom(heap2)

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

將最大的element移除

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

加入element

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

回傳資料個數

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

回傳最大的那個 Element


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