C++ templates: the complete guide
Gespeichert in:
Hauptverfasser: | , |
---|---|
Format: | Buch |
Sprache: | English |
Veröffentlicht: |
Boston [u.a.]
Addison-Wesley
2006
|
Ausgabe: | 8. print. |
Schlagworte: | |
Online-Zugang: | Inhaltsverzeichnis |
Beschreibung: | XVIII, 528 S. |
ISBN: | 0201734842 |
Internformat
MARC
LEADER | 00000nam a2200000zc 4500 | ||
---|---|---|---|
001 | BV021867195 | ||
003 | DE-604 | ||
005 | 20070710 | ||
007 | t | ||
008 | 061207s2006 xxu |||| 00||| eng d | ||
020 | |a 0201734842 |9 0-201-73484-2 | ||
035 | |a (OCoLC)255634447 | ||
035 | |a (DE-599)BVBBV021867195 | ||
040 | |a DE-604 |b ger |e aacr | ||
041 | 0 | |a eng | |
044 | |a xxu |c US | ||
049 | |a DE-20 |a DE-83 | ||
050 | 0 | |a QA76.73.C153 | |
082 | 0 | |a 005.268 | |
084 | |a ST 250 |0 (DE-625)143626: |2 rvk | ||
100 | 1 | |a Vandevoorde, David |e Verfasser |0 (DE-588)136212972 |4 aut | |
245 | 1 | 0 | |a C++ templates |b the complete guide |c David Vandevoorde ; Nicolai M. Josuttis |
250 | |a 8. print. | ||
264 | 1 | |a Boston [u.a.] |b Addison-Wesley |c 2006 | |
300 | |a XVIII, 528 S. | ||
336 | |b txt |2 rdacontent | ||
337 | |b n |2 rdamedia | ||
338 | |b nc |2 rdacarrier | ||
650 | 0 | 7 | |a STL |0 (DE-588)4411326-2 |2 gnd |9 rswk-swf |
650 | 0 | 7 | |a C++ |0 (DE-588)4193909-8 |2 gnd |9 rswk-swf |
689 | 0 | 0 | |a C++ |0 (DE-588)4193909-8 |D s |
689 | 0 | 1 | |a STL |0 (DE-588)4411326-2 |D s |
689 | 0 | |5 DE-604 | |
700 | 1 | |a Josuttis, Nicolai M. |d 1962- |e Verfasser |0 (DE-588)113893469 |4 aut | |
856 | 4 | 2 | |m HBZ Datenaustausch |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=015056130&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |3 Inhaltsverzeichnis |
999 | |a oai:aleph.bib-bvb.de:BVB01-015056130 |
Datensatz im Suchindex
_version_ | 1804135780124196864 |
---|---|
adam_text | Contents
Preface xv
Acknowledgments xvii
1 About This Book 1
1.1 What You Should Know Before Reading This Book 2
1.2 Overall Structure of the Book 2
1.3 How to Read This Book 3
1.4 Some Remarks About Programming Style 3
1.5 The Standard versus Reality 5
1.6 Example Code and Additional Informations 5
1.7 Feedback 5
Part I: The Basics 7
2 Function Templates 9
2.1 A First Look at Function Templates 9
2.1.1 Defining the Template 9
2.1.2 Using the Template 10
2.2 Argument Deduction 12
2.3 Template Parameters 13
2.4 Overloading Function Templates 15
2.5 Summary 19
3 Class Templates 21
3.1 Implementation of Class Template Stack 21
3.1.1 Declaration of Class Templates 22
vi Contents
3.1.2 Implementation of Member Functions 24
3.2 Use of Class Template Stack 25
3.3 Specializations of Class Templates 27
3.4 Partial Specialization 29
3.5 Default Template Arguments 30
3.6 Summary 33
4 Nontype Template Parameters 35
4.1 Nontype Class Template Parameters 35
4.2 Nontype Function Template Parameters 39
4.3 Restrictions for Nontype Template Parameters 40
4.4 Summary 41
5 Tricky Basics 43
5.1 Keyword typename 43
5.2 Using this 45
5.3 Member Templates 45
5.4 Template Template Parameters 50
5.5 Zero Initialization 56
5.6 Using String Literals as Arguments for Function Templates 57
5.7 Summary 60
6 Using Templates in Practice 61
6.1 The Inclusion Model 61
6.1.1 Linker Errors 61
6.1.2 Templates in Header Files 63
6.2 Explicit Instantiation 65
6.2.1 Example of Explicit Instantiation 65
6.2.2 Combining the Inclusion Model and Explicit Instantiation 67
6.3 The Separation Model 68
6.3.1 The Keyword export 68
6.3.2 Limitations of the Separation Model 70
6.3.3 Preparing for the Separation Model 70
6.4 Templates and inline 72
6.5 Precompiled Headers 72
6.6 Debugging Templates 74
Contents vii
6.6.1 Decoding the Error Novel 75
6.6.2 Shallow Instantiation 77
6.6.3 Long Symbols 79
6.6.4 Tracers 79
6.6.5 Oracles 84
6.6.6 Archetypes 85
6.7 Afternotes 85
6.8 Summary 85
7 Basic Template Terminology 87
7.1 Class Template or Template Class ? 87
7.2 Instantiation and Specialization 88
7.3 Declarations versus Definitions 89
7.4 The One Definition Rule 90
7.5 Template Arguments versus Template Parameters 90
Part II: Templates in Depth 93
8 Fundamentals in Depth 95
8.1 Parameterized Declarations 95
8.1.1 Virtual Member Functions 98
8.1.2 Linkage of Templates 99
8.1.3 Primary Templates 100
8.2 Template Parameters 100
8.2.1 Type Parameters 101
8.2.2 Nontype Parameters 101
8.2.3 Template Template Parameters 102
8.2.4 Default Template Arguments 103
8.3 Template Arguments 104
8.3.1 Function Template Arguments 105
8.3.2 Type Arguments 108
8.3.3 Nontype Arguments 109
8.3.4 Template Template Arguments Ill
8.3.5 Equivalence 113
8.4 Friends 113
8.4.1 Friend Functions 114
viii Contents
8.4.2 Friend Templates 117
8.5 Afternotes 117
9 Names in Templates 119
9.1 Name Taxonomy 119
9.2 Looking Up Names 121
9.2.1 Argument Dependent Lookup 123
9.2.2 Friend Name Injection 125
9.2.3 Injected Class Names 126
9.3 Parsing Templates 127
9.3.1 Context Sensitivity in Nontemplates 127
9.3.2 Dependent Names of Types 130
9.3.3 Dependent Names of Templates 132
9.3.4 Dependent Names in Using Declarations 133
9.3.5 ADL and Explicit Template Arguments 135
9.4 Derivation and Class Templates 135
9.4.1 Nondependent Base Classes 135
9.4.2 Dependent Base Classes 136
9.5 Afternotes 139
10 Instantiation 141
10.1 On Demand Instantiation 141
10.2 Lazy Instantiation 143
10.3 The C++Instantiation Model 146
10.3.1 Two Phase Lookup 146
10.3.2 Points of Instantiation 146
10.3.3 The Inclusion and Separation Models 149
10.3.4 Looking Across Translation Units 150
10.3.5 Examples 151
10.4 Implementation Schemes 153
10.4.1 Greedy Instantiation 155
10.4.2 Queried Instantiation 156
10.4.3 Iterated Instantiation 157
10.5 Explicit Instantiation 159
10.6 Afternotes 163
Contents ix
11 Template Argument Deduction 167
11.1 The Deduction Process 167
11.2 Deduced Contexts 169
11.3 Special Deduction Situations 171
11.4 Allowable Argument Conversions 172
11.5 Class Template Parameters 173
11.6 Default Call Arguments 173
11.7 The Barton Nackman Trick 174
11.8 Afternotes 177
12 Specialization and Overloading 179
12.1 When Generic Code Doesn t Quite Cut It 179
12.1.1 Transparent Customization 180
12.1.2 Semantic Transparency 181
12.2 Overloading Function Templates 183
12.2.1 Signatures 184
12.2.2 Partial Ordering of Overloaded Function Templates 186
12.2.3 Formal Ordering Rules 188
12.2.4 Templates and Nontemplates 189
12.3 Explicit Specialization 190
12.3.1 Full Class Template Specialization 190
12.3.2 Full Function Template Specialization 194
12.3.3 Full Member Specialization 197
12.4 Partial Class Template Specialization 200
12.5 Afternotes 203
13 Future Directions 205
13.1 The Angle Bracket Hack 205
13.2 Relaxed typename Rules 206
13.3 Default Function Template Arguments 207
13.4 String Literal and Floating Point Template Arguments 209
13.5 Relaxed Matching of Template Template Parameters 211
13.6 Typedef Templates 212
13.7 Partial Specialization of Function Templates 213
13.8 The typeof Operator 215
x Contents
13.9 Named Template Arguments 216
13.10 Static Properties 218
13.11 Custom Instantiation Diagnostics 218
13.12 Overloaded Class Templates 221
13.13 List Parameters 222
13.14 Layout Control 224
13.15 Initializer Deduction 225
13.16 Function Expressions 226
13.17 Afternotes 228
Part III: Templates and Design 229
14 The Polymorphic Power of Templates 231
14.1 Dynamic Polymorphism 231
14.2 Static Polymorphism 234
14.3 Dynamic versus Static Polymorphism 238
14.4 New Forms of Design Patterns 239
14.5 Generic Programming 240
14.6 Afternotes 243
15 Traits and Policy Classes 245
15.1 An Example: Accumulating a Sequence 245
15.1.1 Fixed Traits 246
15.1.2 Value Traits 250
15.1.3 Parameterized Traits 254
15.1.4 Policies and Policy Classes 255
15.1.5 Traits and Policies: What s the Difference? 258
15.1.6 Member Templates versus Template Template Parameters 259
15.1.7 Combining Multiple Policies and/or Traits 261
15.1.8 Accumulation with General Iterators 262
15.2 Type Functions 263
15.2.1 Determining Element Types 264
15.2.2 Determining Class Types 266
15.2.3 References and Qualifiers 268
15.2.4 Promotion Traits 271
Contents xi
15.3 Policy Traits 275
15.3.1 Read only Parameter Types 276
15.3.2 Copying, Swapping, and Moving 279
15.4 Aftemotes 284
16 Templates and Inheritance 285
16.1 Named Template Arguments 285
16.2 The Empty Base Class Optimization (EBCO) 289
16.2.1 Layout Principles 290
16.2.2 Members as Base Classes 293
16.3 The Curiously Recurring Template Pattern (CRTP) 295
16.4 Parameterized Virtually 298
16.5 Aftemotes 299
17 Metaprograms 301
17.1 A First Example of a Metaprogram 301
17.2 Enumeration Values versus Static Constants 303
17.3 A Second Example: Computing the Square Root 305
17.4 Using Induction Variables 309
17.5 Computational Completeness 312
17.6 Recursive Instantiation versus Recursive Template Arguments 313
17.7 Using Metaprograms to Unroll Loops 314
17.8 Aftemotes 318
18 Expression Templates 321
18.1 Temporaries and Split Loops 322
18.2 Encoding Expressions in Template Arguments 328
18.2.1 Operands of the Expression Templates 328
18.2.2 The Array Type 332
18.2.3 The Operators 334
18.2.4 Review 336
18.2.5 Expression Templates Assignments 338
18.3 Performance and Limitations of Expression Templates 340
18.4 Aftemotes 341
xii Contents
Part IV: Advanced Applications 345
19 Type Classification 347
19.1 Determining Fundamental Types 347
19.2 Determining Compound Types 350
19.3 Identifying Function Types 352
19.4 Enumeration Classification with Overload Resolution 356
19.5 Determining Class Types 359
19.6 Putting It All Together 359
19.7 Afternotes 363
20 Smart Pointers 365
20.1 Holders and Trules 365
20.1.1 Protecting Against Exceptions 366
20.1.2 Holders 368
20.1.3 Holders as Members 370
20.1.4 Resource Acquisition Is Initialization 373
20.1.5 Holder Limitations 373
20.1.6 Copying Holders 375
20.1.7 Copying Holders Across Function Calls 375
20.1.8 Trules 376
20.2 Reference Counting 379
20.2.1 Where Is the Counter? 380
20.2.2 Concurrent Counter Access 381
20.2.3 Destruction and Deallocation 382
20.2.4 The CountingPtr Template 383
20.2.5 A Simple Noninvasive Counter 386
20.2.6 A Simple Invasive Counter Template 388
20.2.7 Constness 390
20.2.8 Implicit Conversions 390
20.2.9 Comparisons 393
20.3 Afternotes 394
21 Tuples 395
21.1 Duos 395
21.2 Recursive Duos 401
21.2.1 Number of Fields 401
Contents xiii
21.2.2 Type of Fields 403
21.2.3 Value of Fields 404
21.3 Tuple Construction 410
21.4 Afternotes 415
22 Function Objects and Callbacks 417
22.1 Direct, Indirect, and Inline Calls 418
22.2 Pointers and References to Functions 421
22.3 Pointer to Member Functions 423
22.4 Class Type Functors 426
22.4.1 A First Example of Class Type Functors 426
22.4.2 Type of Class Type Functors 428
22.5 Specifying Functors 429
22.5.1 Functors as Template Type Arguments 429
22.5.2 Functors as Function Call Arguments 430
22.5.3 Combining Function Call Parameters and Template Type Parameters . . . .431
22.5.4 Functors as Nontype Template Arguments 432
22.5.5 Function Pointer Encapsulation 433
22.6 Introspection 436
22.6.1 Analyzing a Functor Type 436
22.6.2 Accessing Parameter Types 437
22.6.3 Encapsulating Function Pointers 439
22.7 Function Object Composition 445
22.7.1 Simple Composition 446
22.7.2 Mixed Type Composition 450
22.7.3 Reducing the Number of Parameters 454
22.8 Value Binders 457
22.8.1 Selecting the Binding 458
22.8.2 Bound Signature 460
22.8.3 Argument Selection 462
22.8.4 Convenience Functions 468
22.9 Functor Operations: A Complete Implementation 471
22.10 Afternotes 474
xiv Contents
Appendixes 475
A The One Definition Rule 475
A. 1 Translation Units 475
A.2 Declarations and Definitions 476
A.3 The One Definition Rule in Detail 477
A.3.1 One per Program Constraints 477
A.3.2 One per Translation Unit Constraints 479
A.3.3 Cross Translation Unit Equivalence Constraints 481
B Overload Resolution 487
B.I When Does Overload Resolution Kick In? 488
B.2 Simplified Overload Resolution 488
B.2.1 The Implied Argument for Member Functions 490
B.2.2 Refining the Perfect Match 492
B.3 Overloading Details 493
B.3.1 Prefer Nontemplates 493
B.3.2 Conversion Sequences 494
B.3.3 Pointer Conversions 494
B.3.4 Functors and Surrogate Functions 496
B.3.5 Other Overloading Contexts 497
Bibliography 499
Newsgroups 499
Books and Web Sites 500
Glossary 507
Index 517
|
adam_txt |
Contents
Preface xv
Acknowledgments xvii
1 About This Book 1
1.1 What You Should Know Before Reading This Book 2
1.2 Overall Structure of the Book 2
1.3 How to Read This Book 3
1.4 Some Remarks About Programming Style 3
1.5 The Standard versus Reality 5
1.6 Example Code and Additional Informations 5
1.7 Feedback 5
Part I: The Basics 7
2 Function Templates 9
2.1 A First Look at Function Templates 9
2.1.1 Defining the Template 9
2.1.2 Using the Template 10
2.2 Argument Deduction 12
2.3 Template Parameters 13
2.4 Overloading Function Templates 15
2.5 Summary 19
3 Class Templates 21
3.1 Implementation of Class Template Stack 21
3.1.1 Declaration of Class Templates 22
vi Contents
3.1.2 Implementation of Member Functions 24
3.2 Use of Class Template Stack 25
3.3 Specializations of Class Templates 27
3.4 Partial Specialization 29
3.5 Default Template Arguments 30
3.6 Summary 33
4 Nontype Template Parameters 35
4.1 Nontype Class Template Parameters 35
4.2 Nontype Function Template Parameters 39
4.3 Restrictions for Nontype Template Parameters 40
4.4 Summary 41
5 Tricky Basics 43
5.1 Keyword typename 43
5.2 Using this 45
5.3 Member Templates 45
5.4 Template Template Parameters 50
5.5 Zero Initialization 56
5.6 Using String Literals as Arguments for Function Templates 57
5.7 Summary 60
6 Using Templates in Practice 61
6.1 The Inclusion Model 61
6.1.1 Linker Errors 61
6.1.2 Templates in Header Files 63
6.2 Explicit Instantiation 65
6.2.1 Example of Explicit Instantiation 65
6.2.2 Combining the Inclusion Model and Explicit Instantiation 67
6.3 The Separation Model 68
6.3.1 The Keyword export 68
6.3.2 Limitations of the Separation Model 70
6.3.3 Preparing for the Separation Model 70
6.4 Templates and inline 72
6.5 Precompiled Headers 72
6.6 Debugging Templates 74
Contents vii
6.6.1 Decoding the Error Novel 75
6.6.2 Shallow Instantiation 77
6.6.3 Long Symbols 79
6.6.4 Tracers 79
6.6.5 Oracles 84
6.6.6 Archetypes 85
6.7 Afternotes 85
6.8 Summary 85
7 Basic Template Terminology 87
7.1 "Class Template" or "Template Class"? 87
7.2 Instantiation and Specialization 88
7.3 Declarations versus Definitions 89
7.4 The One Definition Rule 90
7.5 Template Arguments versus Template Parameters 90
Part II: Templates in Depth 93
8 Fundamentals in Depth 95
8.1 Parameterized Declarations 95
8.1.1 Virtual Member Functions 98
8.1.2 Linkage of Templates 99
8.1.3 Primary Templates 100
8.2 Template Parameters 100
8.2.1 Type Parameters 101
8.2.2 Nontype Parameters 101
8.2.3 Template Template Parameters 102
8.2.4 Default Template Arguments 103
8.3 Template Arguments 104
8.3.1 Function Template Arguments 105
8.3.2 Type Arguments 108
8.3.3 Nontype Arguments 109
8.3.4 Template Template Arguments Ill
8.3.5 Equivalence 113
8.4 Friends 113
8.4.1 Friend Functions 114
viii Contents
8.4.2 Friend Templates 117
8.5 Afternotes 117
9 Names in Templates 119
9.1 Name Taxonomy 119
9.2 Looking Up Names 121
9.2.1 Argument Dependent Lookup 123
9.2.2 Friend Name Injection 125
9.2.3 Injected Class Names 126
9.3 Parsing Templates 127
9.3.1 Context Sensitivity in Nontemplates 127
9.3.2 Dependent Names of Types 130
9.3.3 Dependent Names of Templates 132
9.3.4 Dependent Names in Using Declarations 133
9.3.5 ADL and Explicit Template Arguments 135
9.4 Derivation and Class Templates 135
9.4.1 Nondependent Base Classes 135
9.4.2 Dependent Base Classes 136
9.5 Afternotes 139
10 Instantiation 141
10.1 On Demand Instantiation 141
10.2 Lazy Instantiation 143
10.3 The C++Instantiation Model 146
10.3.1 Two Phase Lookup 146
10.3.2 Points of Instantiation 146
10.3.3 The Inclusion and Separation Models 149
10.3.4 Looking Across Translation Units 150
10.3.5 Examples 151
10.4 Implementation Schemes 153
10.4.1 Greedy Instantiation 155
10.4.2 Queried Instantiation 156
10.4.3 Iterated Instantiation 157
10.5 Explicit Instantiation 159
10.6 Afternotes 163
Contents ix
11 Template Argument Deduction 167
11.1 The Deduction Process 167
11.2 Deduced Contexts 169
11.3 Special Deduction Situations 171
11.4 Allowable Argument Conversions 172
11.5 Class Template Parameters 173
11.6 Default Call Arguments 173
11.7 The Barton Nackman Trick 174
11.8 Afternotes 177
12 Specialization and Overloading 179
12.1 When "Generic Code" Doesn't Quite Cut It 179
12.1.1 Transparent Customization 180
12.1.2 Semantic Transparency 181
12.2 Overloading Function Templates 183
12.2.1 Signatures 184
12.2.2 Partial Ordering of Overloaded Function Templates 186
12.2.3 Formal Ordering Rules 188
12.2.4 Templates and Nontemplates 189
12.3 Explicit Specialization 190
12.3.1 Full Class Template Specialization 190
12.3.2 Full Function Template Specialization 194
12.3.3 Full Member Specialization 197
12.4 Partial Class Template Specialization 200
12.5 Afternotes 203
13 Future Directions 205
13.1 The Angle Bracket Hack 205
13.2 Relaxed typename Rules 206
13.3 Default Function Template Arguments 207
13.4 String Literal and Floating Point Template Arguments 209
13.5 Relaxed Matching of Template Template Parameters 211
13.6 Typedef Templates 212
13.7 Partial Specialization of Function Templates 213
13.8 The typeof Operator 215
x Contents
13.9 Named Template Arguments 216
13.10 Static Properties 218
13.11 Custom Instantiation Diagnostics 218
13.12 Overloaded Class Templates 221
13.13 List Parameters 222
13.14 Layout Control 224
13.15 Initializer Deduction 225
13.16 Function Expressions 226
13.17 Afternotes 228
Part III: Templates and Design 229
14 The Polymorphic Power of Templates 231
14.1 Dynamic Polymorphism 231
14.2 Static Polymorphism 234
14.3 Dynamic versus Static Polymorphism 238
14.4 New Forms of Design Patterns 239
14.5 Generic Programming 240
14.6 Afternotes 243
15 Traits and Policy Classes 245
15.1 An Example: Accumulating a Sequence 245
15.1.1 Fixed Traits 246
15.1.2 Value Traits 250
15.1.3 Parameterized Traits 254
15.1.4 Policies and Policy Classes 255
15.1.5 Traits and Policies: What's the Difference? 258
15.1.6 Member Templates versus Template Template Parameters 259
15.1.7 Combining Multiple Policies and/or Traits 261
15.1.8 Accumulation with General Iterators 262
15.2 Type Functions 263
15.2.1 Determining Element Types 264
15.2.2 Determining Class Types 266
15.2.3 References and Qualifiers 268
15.2.4 Promotion Traits 271
Contents xi
15.3 Policy Traits 275
15.3.1 Read only Parameter Types 276
15.3.2 Copying, Swapping, and Moving 279
15.4 Aftemotes 284
16 Templates and Inheritance 285
16.1 Named Template Arguments 285
16.2 The Empty Base Class Optimization (EBCO) 289
16.2.1 Layout Principles 290
16.2.2 Members as Base Classes 293
16.3 The Curiously Recurring Template Pattern (CRTP) 295
16.4 Parameterized Virtually 298
16.5 Aftemotes 299
17 Metaprograms 301
17.1 A First Example of a Metaprogram 301
17.2 Enumeration Values versus Static Constants 303
17.3 A Second Example: Computing the Square Root 305
17.4 Using Induction Variables 309
17.5 Computational Completeness 312
17.6 Recursive Instantiation versus Recursive Template Arguments 313
17.7 Using Metaprograms to Unroll Loops 314
17.8 Aftemotes 318
18 Expression Templates 321
18.1 Temporaries and Split Loops 322
18.2 Encoding Expressions in Template Arguments 328
18.2.1 Operands of the Expression Templates 328
18.2.2 The Array Type 332
18.2.3 The Operators 334
18.2.4 Review 336
18.2.5 Expression Templates Assignments 338
18.3 Performance and Limitations of Expression Templates 340
18.4 Aftemotes 341
xii Contents
Part IV: Advanced Applications 345
19 Type Classification 347
19.1 Determining Fundamental Types 347
19.2 Determining Compound Types 350
19.3 Identifying Function Types 352
19.4 Enumeration Classification with Overload Resolution 356
19.5 Determining Class Types 359
19.6 Putting It All Together 359
19.7 Afternotes 363
20 Smart Pointers 365
20.1 Holders and Trules 365
20.1.1 Protecting Against Exceptions 366
20.1.2 Holders 368
20.1.3 Holders as Members 370
20.1.4 Resource Acquisition Is Initialization 373
20.1.5 Holder Limitations 373
20.1.6 Copying Holders 375
20.1.7 Copying Holders Across Function Calls 375
20.1.8 Trules 376
20.2 Reference Counting 379
20.2.1 Where Is the Counter? 380
20.2.2 Concurrent Counter Access 381
20.2.3 Destruction and Deallocation 382
20.2.4 The CountingPtr Template 383
20.2.5 A Simple Noninvasive Counter 386
20.2.6 A Simple Invasive Counter Template 388
20.2.7 Constness 390
20.2.8 Implicit Conversions 390
20.2.9 Comparisons 393
20.3 Afternotes 394
21 Tuples 395
21.1 Duos 395
21.2 Recursive Duos 401
21.2.1 Number of Fields 401
Contents xiii
21.2.2 Type of Fields 403
21.2.3 Value of Fields 404
21.3 Tuple Construction 410
21.4 Afternotes 415
22 Function Objects and Callbacks 417
22.1 Direct, Indirect, and Inline Calls 418
22.2 Pointers and References to Functions 421
22.3 Pointer to Member Functions 423
22.4 Class Type Functors 426
22.4.1 A First Example of Class Type Functors 426
22.4.2 Type of Class Type Functors 428
22.5 Specifying Functors 429
22.5.1 Functors as Template Type Arguments 429
22.5.2 Functors as Function Call Arguments 430
22.5.3 Combining Function Call Parameters and Template Type Parameters . . . .431
22.5.4 Functors as Nontype Template Arguments 432
22.5.5 Function Pointer Encapsulation 433
22.6 Introspection 436
22.6.1 Analyzing a Functor Type 436
22.6.2 Accessing Parameter Types 437
22.6.3 Encapsulating Function Pointers 439
22.7 Function Object Composition 445
22.7.1 Simple Composition 446
22.7.2 Mixed Type Composition 450
22.7.3 Reducing the Number of Parameters 454
22.8 Value Binders 457
22.8.1 Selecting the Binding 458
22.8.2 Bound Signature 460
22.8.3 Argument Selection 462
22.8.4 Convenience Functions 468
22.9 Functor Operations: A Complete Implementation 471
22.10 Afternotes 474
xiv Contents
Appendixes 475
A The One Definition Rule 475
A. 1 Translation Units 475
A.2 Declarations and Definitions 476
A.3 The One Definition Rule in Detail 477
A.3.1 One per Program Constraints 477
A.3.2 One per Translation Unit Constraints 479
A.3.3 Cross Translation Unit Equivalence Constraints 481
B Overload Resolution 487
B.I When Does Overload Resolution Kick In? 488
B.2 Simplified Overload Resolution 488
B.2.1 The Implied Argument for Member Functions 490
B.2.2 Refining the Perfect Match 492
B.3 Overloading Details 493
B.3.1 Prefer Nontemplates 493
B.3.2 Conversion Sequences 494
B.3.3 Pointer Conversions 494
B.3.4 Functors and Surrogate Functions 496
B.3.5 Other Overloading Contexts 497
Bibliography 499
Newsgroups 499
Books and Web Sites 500
Glossary 507
Index 517 |
any_adam_object | 1 |
any_adam_object_boolean | 1 |
author | Vandevoorde, David Josuttis, Nicolai M. 1962- |
author_GND | (DE-588)136212972 (DE-588)113893469 |
author_facet | Vandevoorde, David Josuttis, Nicolai M. 1962- |
author_role | aut aut |
author_sort | Vandevoorde, David |
author_variant | d v dv n m j nm nmj |
building | Verbundindex |
bvnumber | BV021867195 |
callnumber-first | Q - Science |
callnumber-label | QA76 |
callnumber-raw | QA76.73.C153 |
callnumber-search | QA76.73.C153 |
callnumber-sort | QA 276.73 C153 |
callnumber-subject | QA - Mathematics |
classification_rvk | ST 250 |
ctrlnum | (OCoLC)255634447 (DE-599)BVBBV021867195 |
dewey-full | 005.268 |
dewey-hundreds | 000 - Computer science, information, general works |
dewey-ones | 005 - Computer programming, programs, data, security |
dewey-raw | 005.268 |
dewey-search | 005.268 |
dewey-sort | 15.268 |
dewey-tens | 000 - Computer science, information, general works |
discipline | Informatik |
discipline_str_mv | Informatik |
edition | 8. print. |
format | Book |
fullrecord | <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01436nam a2200397zc 4500</leader><controlfield tag="001">BV021867195</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20070710 </controlfield><controlfield tag="007">t</controlfield><controlfield tag="008">061207s2006 xxu |||| 00||| eng d</controlfield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">0201734842</subfield><subfield code="9">0-201-73484-2</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)255634447</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)BVBBV021867195</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield><subfield code="e">aacr</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="044" ind1=" " ind2=" "><subfield code="a">xxu</subfield><subfield code="c">US</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-20</subfield><subfield code="a">DE-83</subfield></datafield><datafield tag="050" ind1=" " ind2="0"><subfield code="a">QA76.73.C153</subfield></datafield><datafield tag="082" ind1="0" ind2=" "><subfield code="a">005.268</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 250</subfield><subfield code="0">(DE-625)143626:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Vandevoorde, David</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)136212972</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">C++ templates</subfield><subfield code="b">the complete guide</subfield><subfield code="c">David Vandevoorde ; Nicolai M. Josuttis</subfield></datafield><datafield tag="250" ind1=" " ind2=" "><subfield code="a">8. print.</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">Boston [u.a.]</subfield><subfield code="b">Addison-Wesley</subfield><subfield code="c">2006</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">XVIII, 528 S.</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">STL</subfield><subfield code="0">(DE-588)4411326-2</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">C++</subfield><subfield code="0">(DE-588)4193909-8</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">C++</subfield><subfield code="0">(DE-588)4193909-8</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2="1"><subfield code="a">STL</subfield><subfield code="0">(DE-588)4411326-2</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="5">DE-604</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Josuttis, Nicolai M.</subfield><subfield code="d">1962-</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)113893469</subfield><subfield code="4">aut</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">HBZ Datenaustausch</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=015056130&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="999" ind1=" " ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-015056130</subfield></datafield></record></collection> |
id | DE-604.BV021867195 |
illustrated | Not Illustrated |
index_date | 2024-07-02T16:01:25Z |
indexdate | 2024-07-09T20:45:56Z |
institution | BVB |
isbn | 0201734842 |
language | English |
oai_aleph_id | oai:aleph.bib-bvb.de:BVB01-015056130 |
oclc_num | 255634447 |
open_access_boolean | |
owner | DE-20 DE-83 |
owner_facet | DE-20 DE-83 |
physical | XVIII, 528 S. |
publishDate | 2006 |
publishDateSearch | 2006 |
publishDateSort | 2006 |
publisher | Addison-Wesley |
record_format | marc |
spelling | Vandevoorde, David Verfasser (DE-588)136212972 aut C++ templates the complete guide David Vandevoorde ; Nicolai M. Josuttis 8. print. Boston [u.a.] Addison-Wesley 2006 XVIII, 528 S. txt rdacontent n rdamedia nc rdacarrier STL (DE-588)4411326-2 gnd rswk-swf C++ (DE-588)4193909-8 gnd rswk-swf C++ (DE-588)4193909-8 s STL (DE-588)4411326-2 s DE-604 Josuttis, Nicolai M. 1962- Verfasser (DE-588)113893469 aut HBZ Datenaustausch application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=015056130&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA Inhaltsverzeichnis |
spellingShingle | Vandevoorde, David Josuttis, Nicolai M. 1962- C++ templates the complete guide STL (DE-588)4411326-2 gnd C++ (DE-588)4193909-8 gnd |
subject_GND | (DE-588)4411326-2 (DE-588)4193909-8 |
title | C++ templates the complete guide |
title_auth | C++ templates the complete guide |
title_exact_search | C++ templates the complete guide |
title_exact_search_txtP | C++ templates the complete guide |
title_full | C++ templates the complete guide David Vandevoorde ; Nicolai M. Josuttis |
title_fullStr | C++ templates the complete guide David Vandevoorde ; Nicolai M. Josuttis |
title_full_unstemmed | C++ templates the complete guide David Vandevoorde ; Nicolai M. Josuttis |
title_short | C++ templates |
title_sort | c templates the complete guide |
title_sub | the complete guide |
topic | STL (DE-588)4411326-2 gnd C++ (DE-588)4193909-8 gnd |
topic_facet | STL C++ |
url | http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=015056130&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |
work_keys_str_mv | AT vandevoordedavid ctemplatesthecompleteguide AT josuttisnicolaim ctemplatesthecompleteguide |