C++ templates the complete guide
Templates are among the most powerful features of C++, but they are too often neglected, misunderstood, and misused. C++ Templates: The Complete Guide provides software architects and engineers with a clear understanding of why, when, and how to use templates to build and maintain cleaner, faster, a...
Autor principal: | |
---|---|
Otros Autores: | |
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Boston, MA :
Addison-Wesley
2003.
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009627230106719 |
Tabla de Contenidos:
- Cover
- Contents
- Preface
- Acknowledgments
- 1 About This Book
- 1.1 What You Should Know Before Reading This Book
- 1.2 Overall Structure of the Book
- 1.3 How to Read This Book
- 1.4 Some Remarks About Programming Style
- 1.5 The Standard versus Reality
- 1.6 Example Code and Additional Informations
- 1.7 Feedback
- Part I: The Basics
- 2 Function Templates
- 2.1 A First Look at Function Templates
- 2.2 Argument Deduction
- 2.3 Template Parameters
- 2.4 Overloading Function Templates
- 2.5 Summary
- 3 Class Templates
- 3.1 Implementation of Class Template Stack
- 3.2 Use of Class Template Stack
- 3.3 Specializations of Class Templates
- 3.4 Partial Specialization
- 3.5 Default Template Arguments
- 3.6 Summary
- 4 Nontype Template Parameters
- 4.1 Nontype Class Template Parameters
- 4.2 Nontype Function Template Parameters
- 4.3 Restrictions for Nontype Template Parameters
- 4.4 Summary
- 5 Tricky Basics
- 5.1 Keyword typename
- 5.2 Using this->
- 5.3 Member Templates
- 5.4 Template Template Parameters
- 5.5 Zero Initialization
- 5.6 Using String Literals as Arguments for Function Templates
- 5.7 Summary
- 6 Using Templates in Practice
- 6.1 The Inclusion Model
- 6.2 Explicit Instantiation
- 6.3 The Separation Model
- 6.4 Templates and inline
- 6.5 Precompiled Headers
- 6.6 Debugging Templates
- 6.7 Afternotes
- 6.8 Summary
- 7 Basic Template Terminology
- 7.1 "Class Template" or "Template Class"?
- 7.2 Instantiation and Specialization
- 7.3 Declarations versus Definitions
- 7.4 The One-Definition Rule
- 7.5 Template Arguments versus Template Parameters
- Part II: Templates in Depth
- 8 Fundamentals in Depth
- 8.1 Parameterized Declarations
- 8.2 Template Parameters
- 8.3 Template Arguments
- 8.4 Friends
- 8.5 Afternotes
- 9 Names in Templates
- 9.1 Name Taxonomy.
- 9.2 Looking Up Names
- 9.3 Parsing Templates
- 9.4 Derivation and Class Templates
- 9.5 Afternotes
- 10 Instantiation
- 10.1 On-Demand Instantiation
- 10.2 Lazy Instantiation
- 10.3 The C++ Instantiation Model
- 10.4 Implementation Schemes
- 10.5 Explicit Instantiation
- 10.6 Afternotes
- 11 Template Argument Deduction
- 11.1 The Deduction Process
- 11.2 Deduced Contexts
- 11.3 Special Deduction Situations
- 11.4 Allowable Argument Conversions
- 11.5 Class Template Parameters
- 11.6 Default Call Arguments
- 11.7 The Barton-Nackman Trick
- 11.8 Afternotes
- 12 Specialization and Overloading
- 12.1 When "Generic Code" Doesn't Quite Cut It
- 12.2 Overloading Function Templates
- 12.3 Explicit Specialization
- 12.4 Partial Class Template Specialization
- 12.5 Afternotes
- 13 Future Directions
- 13.1 The Angle Bracket Hack
- 13.2 Relaxed typename Rules
- 13.3 Default Function Template Arguments
- 13.4 String Literal and Floating-Point Template Arguments
- 13.5 Relaxed Matching of Template Template Parameters
- 13.6 Typedef Templates
- 13.7 Partial Specialization of Function Templates
- 13.8 The typeof Operator
- 13.9 Named Template Arguments
- 13.10 Static Properties
- 13.11 Custom Instantiation Diagnostics
- 13.12 Overloaded Class Templates
- 13.13 List Parameters
- 13.14 Layout Control
- 13.15 Initializer Deduction
- 13.16 Function Expressions
- 13.17 Afternotes
- Part III: Templates and Design
- 14 The Polymorphic Power of Templates
- 14.1 Dynamic Polymorphism
- 14.2 Static Polymorphism
- 14.3 Dynamic versus Static Polymorphism
- 14.4 New Forms of Design Patterns
- 14.5 Generic Programming
- 14.6 Afternotes
- 15 Traits and Policy Classes
- 15.1 An Example: Accumulating a Sequence
- 15.2 Type Functions
- 15.3 Policy Traits
- 15.4 Afternotes
- 16 Templates and Inheritance.
- 16.1 Named Template Arguments
- 16.2 The Empty Base Class Optimization (EBCO)
- 16.3 The Curiously Recurring Template Pattern (CRTP)
- 16.4 Parameterized Virtuality
- 16.5 Afternotes
- 17 Metaprograms
- 17.1 A First Example of a Metaprogram
- 17.2 Enumeration Values versus Static Constants
- 17.3 A Second Example: Computing the Square Root
- 17.4 Using Induction Variables
- 17.5 Computational Completeness
- 17.6 Recursive Instantiation versus Recursive Template Arguments
- 17.7 Using Metaprograms to Unroll Loops
- 17.8 Afternotes
- 18 Expression Templates
- 18.1 Temporaries and Split Loops
- 18.2 Encoding Expressions in Template Arguments
- 18.3 Performance and Limitations of Expression Templates
- 18.4 Afternotes
- Part IV: Advanced Applications
- 19 Type Classification
- 19.1 Determining Fundamental Types
- 19.2 Determining Compound Types
- 19.3 Identifying Function Types
- 19.4 Enumeration Classification with Overload Resolution
- 19.5 Determining Class Types
- 19.6 Putting It All Together
- 19.7 Afternotes
- 20 Smart Pointers
- 20.1 Holders and Trules
- 20.2 Reference Counting
- 20.3 Afternotes
- 21 Tuples
- 21.1 Duos
- 21.2 Recursive Duos
- 21.3 Tuple Construction
- 21.4 Afternotes
- 22 Function Objects and Callbacks
- 22.1 Direct, Indirect, and Inline Calls
- 22.2 Pointers and References to Functions
- 22.3 Pointer-to-Member Functions
- 22.4 Class Type Functors
- 22.5 Specifying Functors
- 22.6 Introspection
- 22.7 Function Object Composition
- 22.8 Value Binders
- 22.9 Functor Operations: A Complete Implementation
- 22.10 Afternotes
- Appendixes
- A: The One-Definition Rule
- A.1 Translation Units
- A.2 Declarations and Definitions
- A.3 The One-Definition Rule in Detail
- B: Overload Resolution
- B.1 When Does Overload Resolution Kick In?
- B.2 Simplified Overload Resolution.
- B.3 Overloading Details
- Bibliography
- Newsgroups
- Books and Web Sites
- Glossary
- A
- C
- D
- E
- F
- H
- I
- L
- M
- N
- O
- P
- Q
- R
- S
- T
- U
- W
- Index.