![]() |
Templates -- Meow
1.1.2
不能,也不應該先編譯成obj-file的templates
|
具有copy on write, 且擁有比C++更靈活的reference機制 More...
#include "Self.h"
Public Member Functions | |
Self (bool create_body) | |
constructor More... | |
Self (Self const &b) | |
不允許copy constructor More... | |
~Self () | |
解構子 More... | |
Data const * | operator-> () const |
回傳指向 Data const 的指標 More... | |
Data * | operator-> () |
回傳指向 Data 的指標, 如有需要, 這邊會做資料的duplicate More... | |
Self & | operator() () const |
回傳非const型態的自己 More... | |
void | copyFrom (Self const &s) |
將給定的 Self 的資料複製到自己這裡 More... | |
void | referenceFrom (Self const &s) |
將自己reference 到給定的 Self More... | |
bool | same (Self const &s) const |
比對兩個 Self 是否指向同一個reference More... | |
bool | equal (Self const &s) const |
比對兩個 Self 的內容是否一樣 More... | |
bool | referenceLess (Self const &s) const |
以reference作為判斷依據的小於判斷 More... | |
void | operator= (Self const &a) |
將 operator= 給disable掉 More... | |
具有copy on write, 且擁有比C++更靈活的reference機制
使用上就是把所有成員變數包到一個class/structure裡, 送給Self
例如以下
Self
這個class會把operator=
給disable掉, 所以使用它當 kernel的class預設的 operator=
都會無法使用
|
inline |
constructor
[in] | create_body | 是否要new一個實體資料 (如果constructor完, 馬上就要 copyFrom() , 或是 referenceFrom() 的話 不太需要 new一個實體, 否則基本上都要 |
meow::Self< Data >::Self | ( | Self< Data > const & | b | ) |
不允許copy constructor
|
inline |
解構子
|
inline |
|
inline |
|
inline |
回傳非const型態的自己
|
inline |
回傳指向 Data const 的指標
|
inline |
回傳指向 Data 的指標, 如有需要, 這邊會做資料的duplicate
void meow::Self< Data >::operator= | ( | Self< Data > const & | a | ) |
將 operator=
給disable掉
|
inline |
|
inline |
|
inline |