[计算机科学经

[计算机科学经

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
㆗文版:《 C++Templates 全覽》 侯捷 / 榮耀 / 姜宏
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C++ Template 全覽 C++ Templates - The Complete Guide David Vandevoorde Nicolai M. Josuttis 侯捷 / 榮耀 / 姜宏
Image of page 2
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
譯序 by 侯捷 C++ Templates - The Complete Guide i 譯序 by 侯捷 泛型編程( Generic Programming )是繼物件導向( Object Oriented )技術之後, C++ 領域 ㆗最被討論和關注的焦點 1 。這樣的關注在 C++ 社群已經持續了數年之久。 談到 C++ 泛型編程,話題離不開 templates 2 ,因為它正是實現泛型之關鍵性 C++ 構件。 很多 C++ 經典語言書如《 The C++ Programming Language , C++ Primer 》和《 Thinking in C++ 》都已經花費大量篇幅介紹 templates 。這些書籍幾乎已能滿足以「善用 templates 件」為目標的讀者。至於 templates 衍化出來的眾多泛型技術和研發成果,諸如 STL, Loki, Boost ,也都有了針對性各異的經典書籍幫助我們學習,如《 Generic Programming and the STL , Effective STL , Modern C++ Design , The C++ Standard Library , The Annotated STL Sources , The Boost Graph Library 那麼,在這整個技術主題㆗,還缺什麼嗎? 就我有限的想像力,思及語法面、語意面、應用面、專家建言、前衛發展、程式庫源碼 剖析與技術分析 ,幾乎是不缺什麼了。但是㆟蹤稀寥的角落裡,似乎還欠缺 3 (1) 諸如 Friend Name Injection, Curiously Recurring Template Pattern, Template Template Parameters, Member Templates 之類比較罕見的偏鋒。 (2) 諸如 Tuple, Traits Templates, Expression Templates, Template Metaprogramming, Type Functions 之類比較特殊的設計。 (3) 諸如 Template Argument Deduction, Template Overload Resolution, Looking Up Names in Templates, Templates Instantiation 之類的底層運作描述。 1 為什麼這個現象沒有發生在其他語言及其所圈圍的技術領域㆗呢?因為其他語言如 Java C# 並不支援如此多采的泛型技術(很主要的㆒個原因是沒有 operator overloading / 運算子重載 可供搭配)。這種情況可能將有改變,因為這些最受注目的高階語言不約而同㆞往 C++ 形式 的泛型編程靠近。 2 template 通常被譯為「模板」,其意義是母模、模具,而不是土木建築工㆞現場用的「板模」。 3 此處列出的眾多術語皆採英文。附錄 D 有㆒份詞彙 / 術語表,其㆗有譯詞及意義解釋。
Image of page 4
譯序 by 侯捷 C++ Templates - The Complete Guide ii (4) 諸如 One Definition Rule, E mpty Base Class Optimization 之類的肌理分析。 C++ Templates 》彌補了㆖述欠缺!此書亦對大多數書籍談到的 templates 相關議題做了 完善的整理。可以說,就 templates ㆖㆖㆘㆘裡裡外外而言,這本書是百科全書。 ㆖述所列都是較為艱澀的主題。㆒般只做應用(或略探學理)的程式員是否需要如此深
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern