TAG

首都機能移轉 (2) 歌詞 (2) 靠北文 (40) 戲言 (30) 糟糕 (7) ACG (23) Assembly (2) Boost (2) C (31) C++ (69) CMake (4) CSIE (67) Debian (34) Design_Pattern (2) Django (1) Eclipse (1) en_US (13) FFmpeg (3) FoolproofProject (26) FreeBSD (2) Git (4) GNU_Linux (65) IDE (5) Java (11) JavaScript (19) KDE (15) Khopper (16) KomiX (3) Kubuntu (18) Life (1) Lighttpd (2) Mac_OS_X (2) Opera (1) PHP (2) PicKing (2) Programing (21) Prolog (1) Python (7) QSnapshot (2) Qt (30) Qt_Jambi (1) Regular_Expression (1) Shell_Script (7) Talk (98) VirtualBox (7) Visual_Studio (13) Windows (18) zh_TW (36)

2010年3月12日 星期五

Forward declaration with template parameters

在避免編譯時間拉長的時候,forward declaration 是個很好的選擇。但是有一些時候你無法使用 forward declaration,一個是該型別其實是個 typedef 的時候,另一個是當這個型別用在 template parameter 的時候。
由於 template class 經常是 inline 的,所以它可能在 header 就必須要知道 template parameter 的大小或成員這些細節。這導致你必須要 include definition 或是改用 pointer。
你說 smart pointer? 不會吧?(笑)

沒有留言:

張貼留言