Modern C++ Design: Generic Programming and Design Patterns Applied (Paperback)
暫譯: 現代 C++ 設計:應用泛型程式設計與設計模式
Andrei Alexandrescu
- 出版商: Addison Wesley
- 出版日期: 2001-02-13
- 售價: $2,480
- 貴賓價: 9.5 折 $2,356
- 語言: 英文
- 頁數: 360
- 裝訂: Paperback
- ISBN: 0201704315
- ISBN-13: 9780201704310
-
相關分類:
C++ 程式語言、Design Pattern
立即出貨(限量) (庫存=3)
買這商品的人也買了...
-
$2,500$2,375 -
$2,200$2,090 -
$680$537 -
$2,640$2,508 -
$2,200$2,090 -
$970Introduction to Algorithms, 2/e
-
$1,150$1,127 -
$1,730$1,644 -
$880$695 -
$1,274Computer Architecture: A Quantitative Approach, 3/e(精裝本)
-
$1,440C++ Templates: The Complete Guide (Hardcover)
-
$650$514 -
$590$466 -
$560$476 -
$480$379 -
$1,176Computer Organization and Design: The Hardware/Software Interface, 3/e(IE) (美國版ISBN:1558606041)
-
$1,995C++ Coding Standards: 101 Rules, Guidelines, and Best Practices (Paperback)
-
$650$507 -
$620$527 -
$2,180$2,071 -
$880$695 -
$550$468 -
$990$891 -
$540$427 -
$1,901Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14 (Paperback)
相關主題
商品描述
Description
Achieve more with C++ than you ever imagined possible!
- Introduces generic components, which offer breakthrough power for maximizing expressiveness, flexibility, and reuse of code.
- Readers will learn exciting, powerful new C++ idioms that will help them master the most modern library writing techniques.
- Forewords by Scott Meyers (Effective C++), one of the world's leading C++ experts, and by John Vlissides, of the IBM T.J. Watson Research center, one of the world's leading patterns experts.
In Modern C++ Design, Andrei Alexandrescu opens new vistas for C++ programmers. Displaying extraordinary creativity and virtuosity, Alexandrescu offers a cutting-edge approach to software design that unites design patterns, generic programming, and C++, enabling programmers to achieve expressive, flexible, and highly reusable code. The book introduces the concept of generic components, reusable design templates that enable an easier and more seamless transition from design to application code, generate code that better expresses the original design intention, and support the reuse of design structures with minimal recoding. The author then shows how to apply this approach to recurring, real-world issues that C++ programmers face in their day-to-day activity. All code is available on the Web, along with Alexandrescu's downloadable Loki C++ library, which provides powerful out-of-the-box functionality for virtually any C++ project. For experienced C++ programmers who have at least some familiarity with the Standard Template Library (STL).
Andrei Alexandrescu is a development manager with RealNetworks, Inc. who specializes in large scale C++ development projects. He is a columnist for C/C++ User's Journal, and was formerly a columnist for C++ Report. Andrei's innovative work with C++ has earned him the respect of leaders throughout the worldwide C++ community.
Appropriate Courses
C++--Intermediate Programming.
Table Of Contents
Foreword by Scott Meyers.
Foreword by John Vlissides.
Preface.
Acknowledgments.
I. TECHNIQUES.
1. Policy-Based Class Design.
The Failure of the Do-It-All Interface.
Multiple Inheritance to the Rescue?
Templates Bring Hope.
Policies and Policy Classes.
Enriched Policies.
Destructors of Policy Classes.
Optional Functionality Through Incomplete Instantiation.
Combining Policy Classes.
Customizing Structure with Policy Classes.
Compatible and Noncompatible Policies.
Decomposing a Class in Policies.
Summary.
2. Techniques.
Partial Template Specialization.
Local Classes 28 2.4 Mapping Integral Constants to Types.
Type-to-Type Mapping.
Type Selection.
Detecting Convertibility and Inheritance at Compile Time.
A Wrapper Around type_info.
NullType and EmptyType.
Type Traits.
Summary.
3. Typelists.
Defining Typelists.
Linearizing Typelist Creation.
Calculating Length.
Intermezzo.
Indexed Access.
Searching Typelists.
Appending to Typelists.
Erasing a Type from a Typelist.
Erasing Duplicates.
Replacing an Element in a Typelist.
Partially Ordering Typelists.
Class Generation with Typelists.
Summary.
Typelist Quick Facts.
4. Small-Object Allocation.
The Workings of a Memory Allocator.
A Small-Object Allocator.
Chunks.
The Fixed-Size Allocator.
The SmallObjAllocator Class.
A Hat Trick.
Simple, Complicated, Yet Simple in the End.
Administrivia.
Summary.
Small-Object Allocator Quick Facts.
II. COMPONENTS.
5. Generalized Functors.
Command in the Real World.
C11 Callable Entities.
The Functor Class Template Skeleton.
Implementing the Forwarding Functor::operator().
Handling Functors.
Build One, Get One Free.
Argument and Return Type Conversions.
Handling Pointers to Member Functions.
Binding.
Chaining Requests.
Real-World Issues I: The Cost of Forwarding Functions.
Real-World Issues II: Heap Allocation.
Implementing Undo and Redo with Functor.
Summary.
Functor Quick Facts.
6. Implementing Singletons.
The Basic C11 Idioms Supporting Singleton.
Enforcing the Singleton's Uniqueness.
Destroying the Singleton.
The Dead Reference Problem.
Addressing the Dead Reference Problem (I):.
Addressing the Dead Reference Problem (II):.
Implementing Singletons with Longevity.
Living in a Multithreaded World.
Putting It All Together.
Working With SingletonHolder.
Summary.
SingletonHolder Class Template Quick Facts.
7. Smart Pointers.
The Deal.
Smart Pointers' Storage.
Smart Pointer Member Functions.
Ownership-Handling Strategies.
The Address-of Operator.
Implicit Conversion to Raw Pointer Type.
Equality and Inequality.
Ordering Comparisons.
Checking and Error Reporting.
Smart Pointers to const and const Smart Pointers.
Arrays.
Smart Pointers and Multithreading.
Putting It All Together.
Summary.
SmartPtr Quick Facts.
8. Object Factories.
Object Factories in C11: Classes and Objects.
Implementing an Object Factory.
Type Identifiers.
Generalization.
Minutiae.
Clone Factories.
Using Object Factories with Other Generic Components.
Summary.
Factory Class Template Quick Facts.
CloneFactory Class Template Quick Facts.
9. Abstract Factory.
A Generic Abstract Factory Interface.
Implementing AbstractFactory.
A Prototype-Based Abstract Factory Implementation.
Summary.
AbstractFactory and ConcreteFactory Quick Facts.
10. Visitor.
Overloading: The Catch-All Function.
An Implementation Refinement: The Acyclic Visitor.
A Generic Implementation of Visitor.
Back to the “Cyclic” Visitor.
Hooking Variations.
Summary.
Visitor Generic Component Quick Facts.
11. Multimethods.
When Are Multimethods Needed?
Double Switch-on-Type: Brute Force.
The Brute-Force Approach Automated.
Symmetry with the Brute-Force Dispatcher.
The Logarithmic Double Dispatcher.
FnDispatcher and Symmetry.
Double Dispatch to Functors.
Converting Arguments: static_cast or dynamic_cast?
Constant-Time Multimethods: Raw Speed.
BasicDispatcher and BasicFastDispatcher as Policies.
Looking Forward.
Summary.
Double Dispatcher Quick Facts.
Appendix A. Minimalist Multithreading Library.
Loki's Approach.
Atomic Operations on Integral Types.
Mutexes.
Locking Semantics in Object-Oriented Programming.
Optional volatile Modifier.
Semaphores, Events, and Other Good Things.
Summary.
Bibliography.
Index. 0201704315T04062001
商品描述(中文翻譯)
描述
達成更多使用 C++,超乎你想像的可能性!
- 介紹泛型元件,這些元件提供突破性的能力,以最大化程式碼的表達性、靈活性和重用性。
- 讀者將學習令人興奮且強大的新 C++ 語法,幫助他們掌握最現代的函式庫撰寫技術。
- 前言由 Scott Meyers(Effective C++)撰寫,他是全球領先的 C++ 專家之一,以及 IBM T.J. Watson 研究中心的 John Vlissides,他是全球領先的設計模式專家之一。
在Modern C++ Design中,Andrei Alexandrescu 為 C++ 程式設計師開啟了新的視野。Alexandrescu 展現了非凡的創造力和技藝,提供了一種前沿的軟體設計方法,結合了設計模式、泛型程式設計和 C++,使程式設計師能夠實現表達性、靈活性和高度可重用的程式碼。本書介紹了泛型元件的概念,這些可重用的設計模板使設計到應用程式碼的過渡變得更簡單、更無縫,生成更能表達原始設計意圖的程式碼,並支持以最小的重新編碼重用設計結構。作者接著展示了如何將這種方法應用於 C++ 程式設計師在日常活動中面臨的重複性現實問題。所有程式碼均可在網路上獲得,並附有 Alexandrescu 可下載的 Loki C++ 函式庫,該函式庫為幾乎任何 C++ 專案提供強大的即用功能。適合對標準模板函式庫(STL)有一定熟悉的經驗豐富的 C++ 程式設計師。
Andrei Alexandrescu 是 RealNetworks, Inc. 的開發經理,專注於大規模 C++ 開發專案。他是C/C++ User's Journal的專欄作家,曾是C++ Report的專欄作家。Andrei 在 C++ 的創新工作使他贏得了全球 C++ 社群領導者的尊重。
適合的課程
C++--中級程式設計。
目錄
- 前言由 Scott Meyers。
- 前言由 John Vlissides。
- 序言。
- 感謝詞。
I. 技術
1. 基於政策的類別設計。
- 軟體設計的多樣性。
- 全能介面的失敗。
- 多重繼承的救援?
- 模板帶來希望。
- 政策和政策類別。
- 豐富的政策。
- 政策類別的解構函數。
- 通過不完整實例化的可選功能。
- 組合政策類別。
- 使用政策類別自定義結構。
- 兼容和不兼容的政策。
- 在政策中分解類別。
- 總結。
2. 技術。
- 編譯時斷言。
- 部分模板特化。
- 本地類別。
- 將整數常數映射到類型。
- 類型到類型的映射。
- 類型選擇。
- 在編譯時檢測可轉換性和繼承。
- type_info 的包裝。
- NullType 和 EmptyType。
- 類型特徵。
- 總結。
3. 類型列表。
- 類型列表的需求。
- 定義類型列表。
- 線性化類型列表的創建。
- 計算長度。
- 中場休息。
- 索引訪問。
- 搜索類型列表。
- 向類型列表附加。
- 從類型列表中刪除類型。
- 刪除重複項。
- 在類型列表中替換元素。
- 部分排序類型列表。
- 使用類型列表生成類別。
- 總結。
- 類型列表快速事實。
4. 小物件分配。
- 預設的自由存儲分配器。
- 記憶體分配器的運作。
- 小物件分配器。
- 區塊。
- 固定大小的分配器。
- SmallObjAllocator 類別。
- 一個帽子把戲。
- 簡單、複雜,但最終簡單。
- 行政事務。
- 總結。
- 小物件分配器快速事實。
II. 元件
5. 一般化函數。
- 命令設計模式。
- 現實世界中的命令。
- C11 可調用實體。
- 函數物件類模板骨架。
- 實現轉發函數::operator()。
- 處理函數物件。
- 買一送一。
- 參數和返回類型轉換。
- 處理成員函數的指標。
- 綁定。
- 請求鏈接。
- 現實世界問題 I:轉發函數的成本。
- 現實世界問題 II:堆分配。
- 使用函數物件實現撤銷和重做。
- 總結。
- 函數物件快速事實。
6. 實現單例。
- 靜態數據 + 靜態函數 != 單例。
- 支持單例的基本 C11 語法。
- 強制單例的唯一性。
- 銷毀單例。
- 死引用問題。
- 解決死引用問題 (I)。
- 解決死引用問題 (II)。
- 實現長壽的單例。
- 生活在多執行緒的世界中。
- 將所有內容整合在一起。
- 與 SingletonHolder 一起工作。
- 總結。
- SingletonHolder 類模板快速事實。
7. 智能指標。
- 智能指標 101。
- 交易。
- 智能指標的存儲。
- 智能指標成員函數。
- 擁有權處理策略。
- 地址運算子。
- 隱式轉換為原始指標類型。
- 相等和不相等。
- 排序比較。
- 檢查和錯誤報告。
- 智能指標和 const 及 const 智能指標。
- 陣列。
- 智能指標和多執行緒。
- 將所有內容整合在一起。
- SmartPtr 快速事實。
8. 物件工廠。
- 物件工廠的需求。
- C11 中的物件工廠:類別和物件。
- 實現物件工廠。
- 類型識別符。
- 一般化。
- 細節。
- 克隆工廠。
- 與其他泛型元件一起使用物件工廠。
- 總結。
- 工廠類模板快速事實。
- CloneFactory 類模板快速事實。
9. 抽象工廠。
- 抽象工廠的架構角色。
- 一個泛型抽象工廠介面。
- 實現 AbstractFactory。
- 基於原型的抽象工廠實現。
- 總結。
- AbstractFactory 和 ConcreteFactory 快速事實。
10. 訪問者。
- 訪問者基礎。
- 重載:萬用函數。
- 實現精煉:非循環訪問者。
- 訪問者的泛型實現。
- 回到“循環”訪問者。
- 鉤子變化。
- 總結。
- 訪問者泛型元件快速事實。
11. 多方法。
- 什麼是多方法?
- 何時需要多方法?
- 雙重類型開關:粗暴的力量。
- 粗暴方法的自動化。
- 與粗暴調度器的對稱性。
- 對數雙重調度。
- FnDispatcher 和對稱性。
- 對函數物件的雙重調度。
- 轉換參數:static_cast 還是 dynamic_cast?
- 常數時間多方法:原始速度。
- BasicDispatcher 和 BasicFastDispatcher 作為政策。
- 展望未來。
- 總結。
- 雙重調度器快速事實。
附錄 A. 最小主義多執行緒函式庫。
- 對多執行緒的批評。
- Loki 的方法。
- 對整數類型的原子操作。
- 互斥鎖。
- 物件導向中的鎖定語義。