Extended STL, Volume 1 (Paperback)

Matthew Wilson

  • 出版商: Addison Wesley
  • 出版日期: 2007-06-29
  • 定價: $1,925
  • 售價: 8.0$1,540
  • 語言: 英文
  • 頁數: 624
  • 裝訂: Paperback
  • ISBN: 0321305507
  • ISBN-13: 9780321305503
  • 相關分類: C++ 程式語言
  • 立即出貨 (庫存 < 4)

買這商品的人也買了...

商品描述

Description:

This book empowers programmers to take the principles and concepts of the STL into new contexts and new forms, thereby addressing a range of programming needs beyond the library's generic components. Appealing to junior and master C++ programmers alike, the book builds on their existing knowledge of, and experience with, the STL, and demonstrates techniques for applying, expanding, and extending it. The book examines three ways the STL can be extended: 1. The application of existing STL concepts to real-world, technology-specific libraries and operating system APIs. This is where the rubber meets the road for practicing programmers. 2. The expansion of existing STL concepts to a wider range of generic components. The book shows, for example, how to provide specialized components needed to increase a program's robustness or efficiency. 3. The extension of existing STL concepts into new and increasingly useful concepts, or the creation of wholly new concepts. The current STL is a valuable tool for programmers; but it's only the beginning. Most of the extended concepts presented in the book are already implemented in the STLSoft libraries, which are included on the CD-ROM.

 

Table of Contents:

Preface

Aims
Subject Matter
Structure
Acknowledgements
Parachutes: Coda

Prologue

A Dichotomy of Character
Principles of UNIX Programming
Seven Signs of Successful C++ Software Libraries
Balancing the Signs: Satisfiction, Dialecticism and Idioms Old and New
Example Libraries

Presentation Conventions

Part I: Foundations

Chapter 1: The Standard Template Library

1.1 Core Concepts
1.2 Containers
1.3 Iterators
1.4 Algorithms
1.5 Function Objects
1.6 Allocators

Chapter 2: Extended STL Concepts, or: "When STL Meets the Real World"

2.1 Terminology
2.2 Collections
2.3 Iterators

Chapter 3: Element Reference Categories

3.1 Introduction
3.2 C++ References
3.3 A Taxonomy of Element Reference Categories
3.4 Using Element Reference Categories
3.5 Defining operator ->()
3.6 Element Reference Categories: Coda

Chapter 4: The Curious Untemporary Reference

Chapter 5: The DRY SPOT Principle

5.1 DRY SPOTs in C++
5.2 Not Quite DRY SPOTs in C++
5.3 Closed Namespaces

Chapter 6: The Law of Leaky Abstractions

Chapter 7: Contract Programming

7.1 Enforcement Types
7.2 Enforcement Mechanisms

Chapter 8: Constraints

Chapter 9: Shims

9.1 Introduction
9.2 Primary Shims
9.3 Composite Shims

Chapter 10: Duck and Goose, or: "The Whimsical Bases of Partial Structural Conformance"

10.1 Conformance
10.2 Explicit Semantic Conformance
10.3 Intersecting Conformance

Chapter 11: RAII

11.1 Mutability
11.2 Resource Source

Chapter 12: Template Tools

12.1 Traits
12.2 Type Generators
12.3 True Typedefs

Chapter 13: Inferred Interface Adaptation: Compile-time Adaptation of Interface-Incomplete Types

13.1 Introduction
13.2 Adapting Interface-Incomplete Types
13.3 Adapting Immutable Collections
13.4 Inferred Interface Adaptation
13.5 Applying IIA to the Range

Chapter 14: Henney's Hypothesis, or: "When Templates Attack!"

Chapter 15: The Independent Autonomies of equal() Friends

15.1 Beware Non-member Friend Function Abuse
15.2 Containers and their Iterators

Chapter 16: Essential Components

16.1 Introduction
16.2 auto_buffer
16.3 filesystem_traits
16.4 file_path_buffer
16.5 scoped_handle
16.6 dl_call()

Part II: Collections

Chapter 17: Adapting the glob API

17.1 Introduction
17.2 Decomposition of Longhand Version
17.3 unixstl::glob_sequence
17.4 Decomposition of Shorthand Version
17.5 Summary

Chapter 18: Intermezzo #1 - Constructor Clashes and Design That Is, If Not Bad, At Least Ill-conceived for Seamless Evolution

Chapter 19: Adapting the opendir/readdir API

19.1 Introduction
19.2 Decomposition of Longhand Version
19.3 unixstl::readdir_sequence
19.4 Alternate Implementations
19.5 Summary

Chapter 20: Adapting The FindFirstFile/FindNextFile API

20.1 Introduction
20.2 Decomposition of Examples
20.3 Sequence Design
20.4 winstl::basic_findfile_sequence
20.5 winstl::basic_findfile_sequence_const_iterator
20.6 winstl::basic_findfile_sequence_value_type
20.7 Shims
20.8 What, no Shims and Constructor Templates?
20.9 Summary
20.10 File-system Enumeration With recls

Chapter 21: Intermezzo: When the Efficiency/Usability Balance is Tipped: Enumerating FTP Server Directories

21.1 inetstl::basic_findfile_sequence
21.2 inetstl::basic_ftpdir_sequence

Chapter 22: Enumerating Processes and Modules

22.1 Collection Characteristics
22.2 winstl::pid_sequence
22.3 winstl::process_module_sequence
22.4 Enumerating All Modules On A System
22.5 Avoiding the System Pseudo Processes
22.6 Handling Optional API Headers
22.7 Summary

Chapter 23: The Fibonacci Sequence

23.1 Introduction
23.2 The Fibonacci Sequence
23.3 Fibonacci as an STL sequence
23.4 Discoverability Failure
23.5 Defining Finite Bounds
23.6 Summary

Chapter 24 Adapting MFC's CArray Container Family

24.1 Introduction
24.2 Motivation
24.3 Emulating std::vector
24.4 Design Considerations
24.5 mfcstl::CArray_adaptor_base Interface
24.6 mfcstl::CArray_cadaptor
24.7 mfcstl::CArray_iadaptor
24.8 Construction
24.9 Allocator
24.10 Element Access Methods
24.11 Iteration
24.12 Size
24.13 Capacity
24.14 Comparison
24.15 Modifiers
24.16 Assignment and swap()
24.17 Summary
24.18 On The CD ...

Chapter 25: A Map Of The Environment

25.1 Introduction
25.2 Motivation
25.3 getenv(), environ, putenv() & setenv()/unsetenv()
25.4 platformstl::environment_variable_traits
25.5 Planning the Interface
25.6 Lookup by Name
25.7 Inserting, Updating and Deleting Values by Name
25.8 Iteration
25.9 Final Iteration Implementation
25.10 Heterogeneous Reference Categories?
25.11 size(), and Subscript by Index
25.12 Summary
25.13 On The CD ...

Chapter 26: Traveling Back and Forth on the Z-Plane

26.1 Prologue
26.2 Introduction
26.3 Version 1: Forward Iteration
26.4 Version 2: Bidirectional Iteration
26.5 Handling External Change
26.6 winstl::child_window_sequence
26.7 Bidirectional Iterator Blues
26.8 winstl::zorder_iterator - A Reversal of Self
26.9 Finalizing the Window Peer Sequences
26.10 Summary
26.11 Z-Plane: Coda

Chapter 27: String Tokenization

27.1 Introduction
27.2 strtok()
27.3 SynesisSTL::StringTokeniser
27.4 Tokenization Use Cases
27.5 Other Tokenization Alternatives
27.6 stlsoft::string_tokenizer
27.7 Test Drive
27.8 The Policy Folly
27.9 Performance
27.10 Summary

Chapter 28: Adapting COM Enumerators

28.1 Introduction
28.2 Motivation
28.3 COM Enumerators
28.4 Decomposition of Longhand Version
28.5 comstl::enumerator_sequence
28.6 comstl::enumerator_sequence::iterator
28.7 comstl::enumerator_sequence::iterator::enumeration_context
28.8 Iterator Cloning Policies
28.9 Choosing a Default Cloning Policy: Applying the Principle of Least Surprise
28.10 Alternative Approaches
28.11 Coming Next ...

Chapter 29: Intermezzo: Correcting Minor Design Omissions with Member Type Inference

Chapter 30: Adapting COM Collections

30.1 Introduction
30.2 Motivation
30.3 comstl::collection_sequence
30.4 Enumerator Acquisition Policies
30.5 Summary

Chapter 31: Gathering Scattered I/O

31.1 Introduction
31.2 Scatter/Gather I/O
31.3 Scatter/Gather I/O APIs
31.4 Adapting ACE_Message_Queue
31.5 Time For Some Cake
31.6 Summary

Chapter 32: Argument-dependent Return-type Variance

32.1 Introduction
32.2 Borrowing A Jewel From Ruby
32.3 Dual-semantic Subscripting in C++
32.4 Generalized Compatibility, via String Access Shims
32.5 A Fly In The int-ment
32.6 Selecting Return Type and Overload
32.7 Argument-dependent Return-type Variance: Coda

Chapter 33: External Iterator Invalidation

33.1 Element-Interface Coherence
33.2 Windows ListBox and ComboBox Controls
33.3 Enumerating Registry Keys and Values
33.4 Summary
33.5 On The CD ...

Part III: Iterators

Chapter 34: An Enhanced ostream_iterator

34.1 Introduction
34.2 std::ostream_iterator
34.3 stlsoft::ostream_iterator
34.4 Defining Stream Insertion Operators
34.5 Summary

Chapter 35: Intermezzo: Proscribing Fatuous Output Iterator Syntax using the Dereference Proxy Pattern

35.1 stlsoft::ostream_iterator::deref_proxy

Chapter 36: Transform Iterator

36.1 Introduction
36.2 Motivation
36.3 Defining Iterator Adaptors
36.4 stlsoft::transform_iterator
36.5 Composite Transformations
36.6 DRY SPOT Violations?
36.7 A Spoonful of Sequence Helps the Medicine ...?
36.8 Summary
36.9 On The CD ...

Chapter 37: Intermezzo: Discretion Being the Better Part of Nomenclature . . .

Chapter 38: Member Selector Iterator

38.1 Introduction
38.2 Motivation
38.3 member_selector_iterator
38.4 Creator Function Woes
38.5 Summary
38.6 On The CD ...

Chapter 39: C-style String Concatenation

39.1 Motivation
39.2 An Inflexible Version
39.3 stlsoft::cstring_concatenator_iterator
39.4 Creator Functions
39.5 Summary
39.6 On The CD ...

Chapter 40: String Object Concatenation

40.1 Introduction
40.2 stlsoft::string_concatenator_iterator
40.3 Heterogeneity of String Type(s)
40.4 But ...
40.5 Summary

Chapter 41: Adapted Iterators Traits

41.1 Introduction
41.2 stlsoft::adapted_iterator_traits
41.3 Summary
41.4 On The CD ...

Chapter 42: Filtered Iteration

42.1 Introduction
42.2 An Invalid Version
42.3 Member Iterators Define Range
42.4 But ... ?
42.5 stlsoft::filter_iterator
42.6 Constraining Iterator Category
42.7 Summary
42.8 On The CD ...

Chapter 43: Composite Iterator Adaptations

43.1 Transforming a Filtered Iterator
43.2 Filtering a Transformed Iterator
43.3 Hedging Our Bets
43.4 Summary

Epilogue

Bibliography
Index

商品描述(中文翻譯)

描述:

這本書使程序員能夠將STL的原則和概念應用於新的情境和形式,從而滿足超越庫的通用組件的一系列編程需求。這本書吸引了初級和高級C++程序員,它建立在他們對STL的現有知識和經驗的基礎上,並展示了應用、擴展和擴展STL的技術。本書探討了STL的三種擴展方式:1. 將現有的STL概念應用於現實世界的技術特定庫和操作系統API。這是實踐程序員的關鍵。2. 將現有的STL概念擴展到更廣泛的通用組件範圍。例如,本書展示了如何提供增加程序的穩健性或效率所需的專用組件。3. 將現有的STL概念擴展到新的且越來越有用的概念,或創建全新的概念。現有的STL是程序員的寶貴工具,但這只是個開始。本書介紹的大多數擴展概念已經在包含在CD-ROM中的STLSoft庫中實現。

目錄:

前言
目標
主題
結構
致謝
附錄:結語

序言
角色的二分法
UNIX編程原則
成功的C++軟件庫的七個標誌
平衡標誌:滿足、辯證法和新舊成語
示例庫

呈現慣例

第一部分:基礎

第1章:標準模板庫
1.1 核心概念
1.2 容器
1.3 迭代器
1.4 算法
1.5 函數對象
1.6 分配器

第2章:擴展的STL概念,或者說'當STL遇到現實世界'
2.1 術語
2.2 集合
2.3 迭代器

第3章:元素引用類別
3.1 簡介
3.2 C++引用
3.3 元素引用類別的分類
3.4 使用元素引用類別
3.5 定義運算符 ->()
3.6 元素引用類別:結語

第4章:奇特的非臨時引用

第5章:DRY SPOT原則
5.1 C++中的DRY SPOT
5.2 C++中不完全的DRY SPOT
5.3 封閉命名空間

第6章:泄漏抽象的法則

第7章:合約編程
7.1 強制類型
7.2 強制機制

第8章:約束

第9章:Shims
9.1 簡介
9.2 主要Shims
9.3 組合Shims

第10章:Du