作者Dannvix (Dan)
看板C_and_CPP
標題[分享] C++ Templates & Generic Programming
時間Mon Nov 9 21:56:13 2015
本魯近日參加 "Effective C++ 3/e" 讀書會
負責第七章 "Templates & Generic Programming"
和大家分享投影片,請不吝指教 <(_ _)>
https://speakerdeck.com/dannvix/c-plus-plus-templates-and-generic-programming
內容包含:
- Item 41: Understand implicit interfaces and compile-time polymorphism
- Item 42: Understand the two meanings of `typename`
- Item 43: Know how to access names in templatized base classes
- Item 44: Factor parameter-independent code out of templates
- Item 45: Use member function templates to accept "all compatible types"
- Item 46: Define non-member function inside templates
when type conversion are desired
- Item 47: Use traits classes for information about types
- Item 48: Be aware of template metaprogramming
// 內容較多故字體偏小,建議下載 PDF 以方便閱讀 :P
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.240.178.38
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1447077381.A.DC1.html
推 gn0111: <(_ _)> 11/09 23:14
推 descent: 看英文版的哦,好猛 11/10 00:10
→ erotic: Thanks for sharing, 有其他章節的投影片嗎? 11/10 16:08
推 yea107: 感謝!!想要看其他章節+1 11/10 16:42
→ Dannvix: 其它章節是別人做的,就無法分享囉 :P 11/10 20:05
推 Sirctal: 我還滿想了解 item 23的XD 11/11 09:25
推 stupid0319: 程式寫的好,要飯要到老 11/11 09:57
→ dreamboat66: b呢? 11/13 00:36
→ dreamboat66: appendix好像有寫說他要找最特化的? 那應該找b不是? 11/13 00:37
→ dreamboat66: 還有最後一頁的 最後一點 The primaray template.... 11/13 00:38
→ dreamboat66: only那部份英文不太理解, 是說以有特化以特化為優先? 11/13 00:39
推 damody: 11/13 15:23
→ firose: 因為它把 b 當作是 a 的 specialization 11/13 22:47
→ firose: and c is more specialized than a 11/13 22:53
推 dreamboat66: b不是全特化嗎?怎會輸c 11/15 10:31
→ firose: 但它們都是 template 要先依 partial ordering 比較 a & c 11/15 12:53
→ firose: 若 a 勝 c 結果就會選 b, 但是現在 c 比 a 特殊. 11/15 12:54