C++ Primer英文版(第5版)

  《C++ Primer英文版(第5版)》
基本信息
作者: (美)李普曼(Lippman,S.B.) (美)拉乔伊(Lajoie,J.) (美)默Moo,B.E.)
出版社:电子工业出版社
ISBN:9787121200380
上架时间:2013-4-23
出版日期:2013 年5月
开本:16开
页码:964
版次:5-1
所属分类:计算机 > 软件与程序设计 > C++ > C++
zcover.jpg
更多关于 》》》《 C++ Primer英文版(第5版)  
内容简介
计算机书籍
  这本久负盛名的C++经典教程,时隔八年之久,终迎来史无前例的重大升级。除令全球无数程序员从中受益,甚至为之迷醉的——C++大师Stanley B. Lippman的丰富实践经验,C++标准委员会原负责人Josée Lajoie对C++标准的深入理解,以及C++先驱Barbara E. Moo在C++教学方面的真知灼见外,更是基于全新的C++11标准进行了全面而彻底的内容更新。非常难能可贵的是,《C++ Primer英文版(第5版)》所有示例均全部采用C++11标准改写,这在经典升级版中极其罕见——充分体现了C++语言的重大进展极其全面实践。书中丰富的教学辅助内容、醒目的知识点提示,以及精心组织的编程示范,让这本书在C++领域的权威地位更加不可动摇。无论是初学者入门,或是中、高级程序员提升,本书均为不容置疑的首选。
目录
《c++ primer英文版(第5版)》
preface
chapter 1 getting started 1
1.1 writing a simple c++program 2
1.1.1 compiling and executing our program 3
1.2 afirstlookat input/output 5
1.3 awordaboutcomments 9
1.4 flowofcontrol 11
1.4.1 the whilestatement 11
1.4.2 the forstatement 13
1.4.3 readinganunknownnumberof inputs 14
1.4.4 the ifstatement 17
1.5 introducingclasses 19
1.5.1 the sales_itemclass 20
1.5.2 afirstlookatmemberfunctions 23
1.6 thebookstoreprogram. 24
chaptersummary 26
definedterms 26
part i the basics 29
chapter 2 variables and basic types 31
2.1 primitivebuilt-intypes 32
2.1.1 arithmetictypes 32
2.1.2 typeconversions 35
2.1.3 literals 38
2.2 variables 41
2.2.1 variabledefinitions 41
2.2.2 variabledeclarations anddefinitions 44
2.2.3 identifiers 46
2.2.4 scopeof aname 48
2.3 compoundtypes 50
2.3.1 references 50
2.3.2 pointers 52
2.3.3 understandingcompoundtypedeclarations 57
2.4 constqualifier 59
2.4.1 references to const 61
2.4.2 pointers and const 62
2.4.3 top-level const 63
2.4.4 constexprandconstantexpressions 65
2.5 dealingwithtypes 67
2.5.1 typealiases 67
2.5.2 the autotypespecifier 68
2.5.3 the decltypetypespecifier 70
2.6 definingourowndatastructures 72
2.6.1 defining the sales_datatype 72
2.6.2 using the sales_dataclass 74
2.6.3 writing our own header files 76
chaptersummary 78
definedterms 78
chapter 3 strings, vectors, and arrays 81
3.1 namespace usingdeclarations 82
3.2 library stringtype 84
3.2.1 defining and initializing strings 84
3.2.2 operations on strings 85
3.2.3 dealing with the characters in a string 90
3.3 library vectortype 96
3.3.1 defining and initializing vectors 97
3.3.2 adding elements to a vector 100
3.3.3 other vectoroperations 102
3.4 introducingiterators 106
3.4.1 usingiterators 106
3.4.2 iteratorarithmetic 111
3.5 arrays 113
3.5.1 definingandinitializingbuilt-inarrays 113
3.5.2 accessingtheelementsof anarray 116
3.5.3 pointers andarrays 117
3.5.4 c-stylecharacterstrings 122
3.5.5 interfacingtooldercode 124
3.6 multidimensionalarrays 125
chaptersummary 131
definedterms 131
chapter 4 expressions 133
4.1 fundamentals 134
4.1.1 basicconcepts 134
4.1.2 precedenceandassociativity 136
4.1.3 orderofevaluation 137
4.2 arithmeticoperators 139
4.3 logical andrelationaloperators 141
4.4 assignmentoperators 144
4.5 increment anddecrementoperators 147
4.6 thememberaccessoperators 150
4.7 theconditionaloperator 151
4.8 thebitwiseoperators 152
4.9 the sizeofoperator 156
4.10 commaoperator 157
4.11 typeconversions 159
4.11.1 thearithmeticconversions 159
4.11.2 other implicitconversions 161
4.11.3 explicitconversions 162
4.12 operatorprecedencetable 166
chaptersummary 168
definedterms 168
chapter 5 statements 171
5.1 simple statements 172
5.2 statementscope 174
5.3 conditional statements 174
5.3.1 the ifstatement 175
5.3.2 the switchstatement 178
5.4 iterativestatements 183
5.4.1 the whilestatement 183
5.4.2 traditional forstatement 185
5.4.3 range forstatement 187
5.4.4 the do whilestatement 189
5.5 jumpstatements 190
5.5.1 the breakstatement 190
5.5.2 the continuestatement 191
5.5.3 the gotostatement 192
5.6 tryblocks andexceptionhandling 193
5.6.1 a throwexpression 193
5.6.2 the tryblock 194
5.6.3 standardexceptions 197
chaptersummary 199
definedterms 199
chapter 6 functions 201
6.1 functionbasics 202
6.1.1 localobjects 204
6.1.2 functiondeclarations 206
6.1.3 separatecompilation 207
6.2 argumentpassing 208
6.2.1 passingargumentsbyvalue 209
6.2.2 passingargumentsbyreference 210
6.2.3 constparametersandarguments 212
6.2.4 arrayparameters 214
6.2.5 main:handlingcommand-lineoptions 218
6.2.6 functionswithvaryingparameters 220
6.3 return types and the returnstatement 222
6.3.1 functionswithnoreturnvalue 223
6.3.2 functionsthatreturnavalue 223
6.3.3 returningapointer toanarray 228
6.4 overloadedfunctions 230
6.4.1 overloadingandscope 234
6.5 features forspecializeduses 236
6.5.1 defaultarguments 236
6.5.2 inline and constexprfunctions 238
6.5.3 aids for debugging 240
6.6 functionmatching 242
6.6.1 argumenttypeconversions 245
6.7 pointers tofunctions 247
chaptersummary 251
definedterms 251
chapter 7 classes 253
7.1 definingabstractdatatypes 254
7.1.1 designing the sales_dataclass 254
7.1.2 defining the revised sales_dataclass 256
7.1.3 definingnonmemberclass-relatedfunctions 260
7.1.4 constructors 262
7.1.5 copy,assignment, anddestruction 267
7.2 accesscontrol andencapsulation 268
7.2.1 friends 269
7.3 additionalclassfeatures 271
7.3.1 classmembersrevisited 271
7.3.2 functions that return *this 275
7.3.3 classtypes 277
7.3.4 friendshiprevisited 279
7.4 classscope 282
7.4.1 namelookupandclassscope 283
7.5 constructorsrevisited 288
7.5.1 constructor initializerlist 288
7.5.2 delegatingconstructors 291
7.5.3 theroleof thedefaultconstructor 293
7.5.4 implicitclass-typeconversions 294
7.5.5 aggregateclasses 298
7.5.6 literalclasses 299
7.6 staticclassmembers 300
chaptersummary 305
definedterms 305
contents xi
part ii the c++ library 307
chapter 8 the io library 309
8.1 the ioclasses 310
8.1.1 nocopyorassignfor ioobjects 311
8.1.2 conditionstates 312
8.1.3 managingtheoutputbuffer 314
8.2 file input and output 316
8.2.1 using file stream objects 317
8.2.2 file modes 319
8.3 stringstreams 321
8.3.1 using an istringstream 321
8.3.2 using ostringstreams 323
chaptersummary 324
definedterms 324
chapter 9 sequential containers 325
9.1 overviewof the sequentialcontainers 326
9.2 containerlibraryoverview 328
9.2.1 iterators 331
9.2.2 containertypemembers 332
9.2.3 begin and endmembers 333
9.2.4 definingandinitializingacontainer 334
9.2.5 assignment and swap 337
9.2.6 containersizeoperations 340
9.2.7 relationaloperators 340
9.3 sequentialcontaineroperations 341
9.3.1 addingelements toasequentialcontainer 341
9.3.2 accessingelements 346
9.3.3 erasingelements 348
9.3.4 specialized forward_listoperations 350
9.3.5 resizingacontainer 352
9.3.6 containeroperationsmayinvalidateiterators 353
9.4 how a vectorgrows 355
9.5 additional stringoperations 360
9.5.1 other ways to construct strings 360
9.5.2 other ways to change a string 361
9.5.3 stringsearchoperations 364
9.5.4 the comparefunctions 366
9.5.5 numericconversions 367
9.6 containeradaptors 368
chaptersummary 372
definedterms 372
chapter 10 generic algorithms 375
10.1 overview. 376
10.2 afirstlookat thealgorithms 378
10.2.1 read-onlyalgorithms 379
10.2.2 algorithmsthatwritecontainerelements 380
10.2.3 algorithmsthatreordercontainerelements 383
10.3 customizingoperations 385
10.3.1 passingafunctiontoanalgorithm 386
10.3.2 lambdaexpressions 387
10.3.3 lambdacapturesandreturns 392
10.3.4 bindingarguments 397
10.4 revisiting iterators 401
10.4.1 insert iterators 401
10.4.2 iostream iterators 403
10.4.3 reverse iterators 407
10.5 structureofgenericalgorithms 410
10.5.1 thefive iteratorcategories 410
10.5.2 algorithmparameterpatterns 412
10.5.3 algorithmnamingconventions 413
10.6 container-specificalgorithms 415
chaptersummary 417
definedterms 417
chapter 11 associative containers 419
11.1 usinganassociativecontainer 420
11.2 overviewof theassociativecontainers 423
11.2.1 defininganassociativecontainer 423
11.2.2 requirements onkeytype 424
11.2.3 the pairtype 426
11.3 operations onassociativecontainers 428
11.3.1 associativecontainer iterators 429
11.3.2 addingelements 431
11.3.3 erasingelements 434
11.3.4 subscripting a map 435
11.3.5 accessingelements 436
11.3.6 awordtransformationmap 440
11.4 theunorderedcontainers 443
chaptersummary 447
definedterms 447
chapter 12 dynamicmemory 449
12.1 dynamicmemoryandsmartpointers 450
12.1.1 the shared_ptrclass 450
12.1.2 managingmemorydirectly 458
12.1.3 using shared_ptrs with new 464
12.1.4 smartpointers andexceptions 467
12.1.5 unique_ptr 470
12.1.6 weak_ptr 473
12.2 dynamicarrays 476
12.2.1 newandarrays 477
12.2.2 the allocatorclass 481
12.3 usingthelibrary:atext-queryprogram 484
12.3.1 designof thequeryprogram 485
12.3.2 definingthequeryprogramclasses 487
chaptersummary 491
definedterms 491
part iii tools for class authors 493
chapter 13 copy control 495
13.1 copy,assign, anddestroy 496
13.1.1 thecopyconstructor 496
13.1.2 thecopy-assignmentoperator 500
13.1.3 thedestructor 501
13.1.4 theruleofthree/five 503
13.1.5 using = default 506
13.1.6 preventingcopies 507
13.2 copycontrol andresourcemanagement 510
13.2.1 classesthatactlikevalues 511
13.2.2 definingclassesthatactlikepointers 513
13.3 swap 516
13.4 acopy-controlexample 519
13.5 classesthatmanagedynamicmemory 524
13.6 movingobjects 531
13.6.1 rvaluereferences 532
13.6.2 moveconstructor andmoveassignment 534
13.6.3 rvaluereferencesandmemberfunctions 544
chaptersummary 549
definedterms 549
chapter 14 overloaded operations and conversions 551
14.1 basicconcepts 552
14.2 input andoutputoperators 556
14.2.1 overloading the output operator [[557
14.2.2 overloading the input operator ]]. 558
14.3 arithmetic andrelationaloperators 560
14.3.1 equalityoperators 561
14.3.2 relationaloperators 562
14.4 assignmentoperators 563
14.5 subscriptoperator 564
14.6 increment anddecrementoperators 566
14.7 memberaccessoperators 569
14.8 function-calloperator 571
14.8.1 lambdasarefunctionobjects 572
14.8.2 library-definedfunctionobjects 574
14.8.3 callable objects and function 576
14.9 overloading,conversions, andoperators 579
14.9.1 conversionoperators 580
14.9.2 avoidingambiguousconversions 583
14.9.3 functionmatchingandoverloadedoperators 587
chaptersummary 590
definedterms 590
chapter 15 object-oriented programming 591
15.1 oop:anoverview 592
15.2 definingbaseandderivedclasses 594
15.2.1 definingabaseclass 594
15.2.2 definingaderivedclass 596
15.2.3 conversions andinheritance 601
15.3 virtualfunctions 603
15.4 abstractbaseclasses 608
15.5 accesscontrol andinheritance 611
15.6 classscopeunder inheritance 617
15.7 constructors andcopycontrol 622
15.7.1 virtualdestructors 622
15.7.2 synthesizedcopycontrol andinheritance 623
15.7.3 derived-classcopy-controlmembers 625
15.7.4 inheritedconstructors 628
15.8 containers andinheritance 630
15.8.1 writing a basketclass 631
15.9 textqueriesrevisited 634
15.9.1 anobject-orientedsolution 636
15.9.2 the query_base and queryclasses 639
15.9.3 thederivedclasses 642
15.9.4 the evalfunctions 645
chaptersummary 649
definedterms 649
chapter 16 templates and generic programming 651
16.1 definingatemplate. 652
16.1.1 functiontemplates 652
16.1.2 classtemplates 658
16.1.3 templateparameters 668
16.1.4 membertemplates 672
16.1.5 controlling instantiations 675
16.1.6 efficiency and flexibility 676
16.2 templateargumentdeduction 678
16.2.1 conversions andtemplatetypeparameters 679
16.2.2 function-templateexplicitarguments 681
16.2.3 trailing return types and type transformation 683
16.2.4 functionpointers andargumentdeduction 686
16.2.5 templateargumentdeductionandreferences 687
16.2.6 understanding std::move 690
16.2.7 forwarding 692
16.3 overloadingandtemplates 694
16.4 variadictemplates 699
16.4.1 writingavariadicfunctiontemplate 701
16.4.2 packexpansion 702
16.4.3 forwardingparameterpacks 704
16.5 template specializations 706
chaptersummary 713
definedterms 713
part iv advanced topics 715
chapter 17 specialized library facilities 717
17.1 the tupletype 718
17.1.1 defining and initializing tuples 718
17.1.2 using a tuple toreturnmultiplevalues 721
17.2 the bitsettype 723
17.2.1 defining and initializing bitsets 723
17.2.2 operations on bitsets 725
17.3 regularexpressions 728
17.3.1 usingtheregularexpressionlibrary 729
17.3.2 thematchandregex iteratortypes 734
17.3.3 usingsubexpressions 738
17.3.4 using regex_replace 741
17.4 randomnumbers 745
17.4.1 random-numberengines anddistribution 745
17.4.2 otherkinds ofdistributions 749
17.5 the iolibraryrevisited 752
17.5.1 formattedinput andoutput 753
17.5.2 unformattedinput/outputoperations 761
17.5.3 randomaccess toastream 763
chaptersummary 769
definedterms 769
chapter 18 tools for large programs 771
18.1 exceptionhandling 772
18.1.1 throwinganexception 772
18.1.2 catchinganexception 775
18.1.3 function tryblocks andconstructors 777
18.1.4 the noexceptexceptionspecification 779
18.1.5 exceptionclasshierarchies 782
18.2 namespaces 785
18.2.1 namespacedefinitions 785
18.2.2 usingnamespacemembers 792
18.2.3 classes,namespaces,andscope 796
18.2.4 overloadingandnamespaces 800
18.3 multiple andvirtual inheritance 802
18.3.1 multiple inheritance 803
18.3.2 conversions andmultiplebaseclasses 805
18.3.3 classscopeundermultiple inheritance 807
18.3.4 virtual inheritance 810
18.3.5 constructors andvirtual inheritance 813
chaptersummary 816
definedterms 816
chapter 19 specialized tools and techniques 819
19.1 controlling memory allocation 820
19.1.1 overloading new and delete 820
19.1.2 placement newexpressions 823
19.2 run-timetypeidentification 825
19.2.1 the dynamic_castoperator 825
19.2.2 the typeidoperator 826
19.2.3 usingrtti 828
19.2.4 the type_infoclass 831
19.3 enumerations 832
19.4 pointer toclassmember 835
19.4.1 pointers todatamembers 836
19.4.2 pointers tomemberfunctions 838
19.4.3 usingmemberfunctions ascallableobjects 841
19.5 nestedclasses 843
19.6 union:aspace-savingclass 847
19.7 localclasses 852
19.8 inherentlynonportablefeatures 854
19.8.1 bit-fields 854
19.8.2 volatilequalifier 856
19.8.3 linkage directives: extern "c" 857
chaptersummary 862
definedterms 862
appendix a the library 865
a.1 librarynames andheaders 866
a.2 abrieftourof thealgorithms 870
a.2.1 algorithms tofindanobject 871
a.2.2 otherread-onlyalgorithms 872
a.2.3 binarysearchalgorithms 873
a.2.4 algorithmsthatwritecontainerelements 873
a.2.5 partitioningandsortingalgorithms 875
a.2.6 generalreorderingoperations 877
a.2.7 permutationalgorithms 879
a.2.8 setalgorithms forsortedsequences 880
a.2.9 minimumandmaximumvalues 880
a.2.10 numericalgorithms 881
a.3 randomnumbers 882
a.3.1 randomnumberdistributions 883
a.3.2 randomnumberengines 884

图书信息来源: 中国互动出版网

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16566727/viewspace-758604/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16566727/viewspace-758604/

【原书名】 C++ Primer (4th Edition) 【原出社】 Addison Wesley/Pearson 【作者】 (美)Stanley B.Lippman,Josée LaJoie,Barbara E.Moo 【译者】 李师贤 蒋爱军 梅晓勇 林瑛 【丛书名】 图灵计算机科学丛书 【出社】 人民邮电出社 【书号】 7-115-14554-7 【开本】 16开 【页码】 900 【出日期】 2006-3-1 【次】 4-1 【内容简介】 本书是久负盛名的C++经典教程,其内容是C++大师Stanley B. Lippman丰富的实践经验和C++标准委员会原负责人Josée Lajoie对C++标准深入理解的完美结合,已经帮助全球无数程序员学会了C++。本对前一进行了彻底的修订,内容经过了重新组织,更加入了C++ 先驱Barbara E. Moo在C++教学方面的真知灼见。既显著改善了可读性,又充分体现了C++语言的最新进展和当前的业界最佳实践。书中不但新增大量教学辅助内容,用于强调重要的知识点,提醒常见的错误,推荐优秀的编程实践,给出使用提示,还包含大量来自实战的示例和习题。对C++基本概念和技术全面而且权威的阐述,对现代C++编程风格的强调,使本书成为C++初学者的最佳指南;对于中高级程序员,本书也是不可或缺的参考书。本书的前言阐述了 第4和前一的不同之处。 【目录信息】 第1章 快速入门 1 1.1 编写简单的C++程序 2 1.2 初窥输入/输出 5 1.2.1 标准输入与输出对象 5 1.2.2 一个使用IO库的程序 5 1.3 关于注释 8 1.4 控制结构 10 1.4.1 while语句 10 1.4.2 for语句 12 1.4.3 if语句 14 1.4.4 读入未知数目的输入 15 1.5 类的简介 17 1.5.1 Sales_item类 17 1.5.2 初窥成员函数 19 1.6 C++程序 21 小结 22 术语 22 第一部分 基本语言 第2章 变量和基本类型 29 2.1 基本内置类型 30 2.1.1 整型 30 2.1.2 浮点型 32 2.2 字面值常量 34 2.3 变量 38 2.3.1 什么是变量 39 2.3.2 变量名 40 2.3.3 定义对象 42 2.3.4 变量初始化规则 44 2.3.5 声明和定义 45 2.3.6 名字的作用域 46 2.3.7 在变量使用处定义变量 48 2.4 const限定符 49 2.5 引用 50 2.6 typedef名字 53 2.7 枚举 53 2.8 类类型 54 2.9 编写自己的头文件 57 2.9.1 设计自己的头文件 58 2.9.2 预处理器的简单介绍 60 小结 62 术语 62 第3章 标准库类型 67 3.1 命名空间的using声明 68 3.2 标准库string类型 70 3.2.1 string对象的定义和初始化 70 3.2.2 String对象的读写 71 3.2.3 string对象的操作 72 3.2.4 string对象中字符的处理 76 3.3 标准库vector类型 78 3.3.1 vector对象的定义和初始化 79 3.3.2 vector对象的操作 81 3.4 迭代器简介 83 3.5 标准库bitset类型 88 3.5.1 bitset对象的定义和初始化 88 3.5.2 bitset对象上的操作 90 小结 92 术语 92 第4章 数组和指针 95 4.1 数组 96 4.1.1 数组的定义和初始化 96 4.1.2 数组操作 99 4.2 指针的引入 100 4.2.1 什么是指针 100 4.2.2 指针的定义和初始化 101 4.2.3 指针操作 104 4.2.4 使用指针访问数组元素 106 4.2.5 指针和const限定符 110 4.3 C风格字符串 113 4.3.1 创建动态数组 117 4.3.2 新旧代码的兼容 120 4.4 多维数组 122 小结 124 术语 1255章 表达式 127 5.1 算术操作符 129 5.2 关系操作符和逻辑操作符 131 5.3 位操作符 134 5.3.1 bitset对象或整型值的使用 135 5.3.2 将移位操作符用于IO 137 5.4 赋值操作符 137 5.4.1 赋值操作的右结合性 138 5.4.2 赋值操作具有低优先级 138 5.4.3 复合赋值操作符 139 5.5 自增和自减操作符 140 5.6 箭头操作符 142 5.7 条件操作符 143 5.8 sizeof操作符 144 5.9 逗号操作符 145 5.10 复合表达式的求值 145 5.10.1 优先级 145 5.10.2 结合性 146 5.10.3 求值顺序 148 5.11 new和delete表达式 150 5.12 类型转换 154 5.12.1 何时发生隐式类型转换 154 5.12.2 算术转换 155 5.12.3 其他隐式转换 156 5.12.4 显式转换 158 5.12.5 何时需要强制类型转换 158 5.12.6 命名的强制类型转换 158 5.12.7 旧式强制类型转换 160 小结 161 术语 162 第6章 语句 165 6.1 简单语句 166 6.2 声明语句 167 6.3 复合语句(块) 167 6.4 语句作用域 168 6.5 if语句 169 6.6 switch语句 172 6.6.1 使用switch 173 6.6.2 switch中的控制流 173 6.6.3 default标号 175 6.6.4 switch表达式与case标号 176 6.6.5 switch内部的变量定义 176 6.7 while语句 177 6.8 for循环语句 179 6.8.1 省略for语句头的某些部分 180 6.8.2 for语句头中的多个定义 181 6.9 do while语句 182 6.10 break语句 183 6.11 continue语句 184 6.12 goto语句 185 6.13 try块和异常处理 186 6.13.1 throw表达式 186 6.13.2 try块 187 6.13.3 标准异常 189 6.14 使用预处理器进行调试 190 小结 192 术语 192 第7章 函数 195 7.1 函数的定义 196 7.1.1 函数返回类型 197 7.1.2 函数形参表 198 7.2 参数传递 199 7.2.1 非引用形参 199 7.2.2 引用形参 201 7.2.3 vector和其他容器类型的形参 206 7.2.4 数组形参 206 7.2.5 传递给函数的数组的处理 209 7.2.6 main:处理命令行选项 210 7.2.7 含有可变形参的函数 211 7.3 return语句 211 7.3.1 没有返回值的函数 212 7.3.2 具有返回值的函数 212 7.3.3 递归 216 7.4 函数声明 217 7.5 局部对象 220 7.5.1 自动对象 220 7.5.2 静态局部对象 220 7.6 内联函数 221 7.7 类的成员函数 222 7.7.1 定义成员函数的函数体 223 7.7.2 在类外定义成员函数 225 7.7.3 编写Sales_item类的构造 函数 225 7.7.4 类代码文件的组织 227 7.8 重载函数 228 7.8.1 重载与作用域 230 7.8.2 函数匹配与实参转换 231 7.8.3 重载确定的三个步骤 232 7.8.4 实参类型转换 234 7.9 指向函数的指针 237 小结 239 术语 240 第8章 标准IO库 243 8.1 面向对象的标准库 244 8.2 条件状态 247 8.3 输出缓冲区的管理 249 8.4 文件的输入和输出 251 8.4.1 文件流对象的使用 251 8.4.2 文件模式 254 8.4.3 一个打开并检查输入文件的 程序 256 8.5 字符串流 257 小结 259 术语 259 第二部分 容器和算法 第9章 顺序容器 263 9.1 顺序容器的定义 264 9.1.1 容器元素的初始化 265 9.1.2 容器内元素的类型约束 267 9.2 迭代器和迭代器范围 268 9.2.1 迭代器范围 270 9.2.2 使迭代器失效的容器操作 271 9.3 顺序容器的操作 272 9.3.1 容器定义的类型别名 272 9.3.2 begin和end成员 273 9.3.3 在顺序容器中添加元素 273 9.3.4 关系操作符 277 9.3.5 容器大小的操作 278 9.3.6 访问元素 279 9.3.7 删除元素 280 9.3.8 赋值与swap 282 9.4 vector容器的自增长 284 9.5 容器的选用 287 9.6 再谈string类型 289 9.6.1 构造string对象的其他方法 290 9.6.2 修改string对象的其他方法 292 9.6.3 只适用于string类型的操作 293 9.6.4 string类型的查找操作 295 9.6.5 string对象的比较 298 9.7 容器适配器 300 9.7.1 栈适配器 301 9.7.2 队列和优先级队列 302 小结 303 术语 303 第10章 关联容器 305 10.1 引言:pair类型 306 10.2 关联容器 308 10.3 map类型 309 10.3.1 map对象的定义 309 10.3.2 map定义的类型 310 10.3.3 给map添加元素 311 10.3.4 使用下标访问map对象 311 10.3.5 map::insert的使用 313 10.3.6 查找并读取map中的元素 315 10.3.7 从map对象中删除元素 316 10.3.8 map对象的迭代遍历 316 10.3.9 “单词转换”map对象 317 10.4 set类型 319 10.4.1 set容器的定义和使用 319 10.4.2 创建“单词排除”集 321 10.5 multimap和multiset类型 322 10.5.1 元素的添加和删除 322 10.5.2 在multimap和multiset 中查找元素 323 10.6 容器的综合应用:文本查询程序 325 10.6.1 查询程序的设计 326 10.6.2 TextQuery类 327 10.6.3 TextQuery类的使用 328 10.6.4 编写成员函数 330 小结 332 术语 332 第11章 泛型算法 335 11.1 概述 336 11.2 初窥算法 339 11.2.1 只读算法 339 11.2.2 写容器元素的算法 341 11.2.3 对容器元素重新排序的算法 343 11.3 再谈迭代器 347 11.3.1 插入迭代器 348 11.3.2 iostream迭代器 349 11.3.3 反向迭代器 353 11.3.4 const迭代器 355 11.3.5 五种迭代器 356 11.4 泛型算法的结构 358 11.4.1 算法的形参模式 359 11.4.2 算法的命名规范 359 11.5 容器特有的算法 361 小结 362 术语 363 第三部分 类和数据抽象 第12章 类 367 12.1 类的定义和声明 368 12.1.1 类定义:扼要重述 368 12.1.2 数据抽象和封装 369 12.1.3 关于类定义的更多内容 372 12.1.4 类声明与类定义 374 12.1.5 类对象 375 12.2 隐含的this指针 376 12.3 类作用域 380 类作用域中的名字查找 382 12.4 构造函数 385 12.4.1 构造函数初始化式 387 12.4.2 默认实参与构造函数 391 12.4.3 默认构造函数 392 12.4.4 隐式类类型转换 393 12.4.5 类成员的显式初始化 396 12.5 友元 396 12.6 static类成员 398 12.6.1 static成员函数 400 12.6.2 static数据成员 400 小结 403 术语 403 第13章 复制控制 405 13.1 复制构造函数 406 13.1.1 合成的复制构造函数 409 13.1.2 定义自己的复制构造函数 409 13.1.3 禁止复制 410 13.2 赋值操作符 411 13.3 析构函数 412 13.4 消息处理示例 415 13.5 管理指针成员 419 13.5.1 定义智能指针类 421 13.5.2 定义值型类 425 小结 427 术语 427 第14章 重载操作符与转换 429 14.1 重载操作符的定义 430 14.2 输入和输出操作符 435 14.2.1 输出操作符<>的重载 437 14.3 算术操作符和关系操作符 439 14.3.1 相等操作符 440 14.3.2 关系操作符 441 14.4 赋值操作符 441 14.5 下标操作符 442 14.6 成员访问操作符 443 14.7 自增操作符和自减操作符 446 14.8 调用操作符和函数对象 449 14.8.1 将函数对象用于标准库算法 450 14.8.2 标准库定义的函数对象 451 14.8.3 函数对象的函数适配器 453 14.9 转换与类类型 454 14.9.1 转换为什么有用 454 14.9.2 转换操作符 455 14.9.3 实参匹配和转换 458 14.9.4 重载确定和类的实参 461 14.9.5 重载、转换和操作符 464 小结 466 术语 467 第四部分 面向对象编程与泛型编程 第15章 面向对象编程 471 15.1 面向对象编程:概述 472 15.2 定义基类和派生类 473 15.2.1 定义基类 474 15.2.2 protected成员 475 15.2.3 派生类 476 15.2.4 virtual与其他成员函数 479 15.2.5 公用、私有和受保护的继承 482 15.2.6 友元关系与继承 486 15.2.7 继承与静态成员 486 15.3 转换与继承 487 15.3.1 派生类到基类的转换 487 15.3.2 基类到派生类的转换 489 15.4 构造函数和复制控制 490 15.4.1 基类构造函数和复制控制 490 15.4.2 派生类构造函数 490 15.4.3 复制控制和继承 494 15.4.4 虚析构函数 495 15.4.5 构造函数和析构函数中的虚函数 497 15.5 继承情况下的类作用域 497 15.5.1 名字查找在编译时发生 498 15.5.2 名字冲突与继承 498 15.5.3 作用域与成员函数 499 15.5.4 虚函数与作用域 500 15.6 纯虚函数 502 15.7 容器与继承 503 15.8 句柄类与继承 504 15.8.1 指针型句柄 505 15.8.2 复制未知类型 507 15.8.3 句柄的使用 508 15.9 再谈文本查询示例 511 15.9.1 面向对象的解决方案 513 15.9.2 值型句柄 514 15.9.3 Query_base类 515 15.9.4 Query句柄类 516 15.9.5 派生类 518 15.9.6 eval函数 520 小结 522 术语 523 第16章 模板与泛型编程 525 16.1 模板定义 526 16.1.1 定义函数模板 526 16.1.2 定义类模板 528 16.1.3 模板形参 529 16.1.4 模板类型形参 531 16.1.5 非类型模板形参 533 16.1.6 编写泛型程序 534 16.2 实例化 535 16.2.1 模板实参推断 537 16.2.2 函数模板的显式实参 540 16.3 模板编译模型 542 16.4 类模板成员 545 16.4.1 类模板成员函数 548 16.4.2 非类型形参的模板实参 551 16.4.3 类模板中的友元声明 552 16.4.4 Queue和QueueItem的友元 声明 554 16.4.5 成员模板 556 16.4.6 完整的Queue类 558 16.4.7 类模板的static成员 559 16.5 一个泛型句柄类 560 16.5.1 定义句柄类 561 16.5.2 使用句柄 562 16.6 模板特化 564 16.6.1 函数模板的特化 565 16.6.2 类模板的特化 567 16.6.3 特化成员而不特化类 569 16.6.4 类模板的部分特化 570 16.7 重载与函数模板 570 小结 573 术语 574 第五部分 高级主题 第17章 用于大型程序的工具 579 17.1 异常处理 580 17.1.1 抛出类类型的异常 581 17.1.2 栈展开 582 17.1.3 捕获异常 583 17.1.4 重新抛出 585 17.1.5 捕获所有异常的处理代码 586 17.1.6 函数测试块与构造函数 586 17.1.7 异常类层次 587 17.1.8 自动资源释放 589 17.1.9 auto_ptr类 591 17.1.10 异常说明 595 17.1.11 函数指针的异常说明 598 17.2 命名空间 599 17.2.1 命名空间的定义 599 17.2.2 嵌套命名空间 603 17.2.3 未命名的命名空间 604 17.2.4 命名空间成员的使用 606 17.2.5 类、命名空间和作用域 609 17.2.6 重载与命名空间 612 17.2.7 命名空间与模板 614 17.3 多重继承与虚继承 614 17.3.1 多重继承 615 17.3.2 转换与多个基类 617 17.3.3 多重继承派生类的复制控制 619 17.3.4 多重继承下的类作用域 620 17.3.5 虚继承 622 17.3.6 虚基类的声明 624 17.3.7 特殊的初始化语义 625 小结 628 术语 628 第18章 特殊工具与技术 631 18.1 优化内存分配 632 18.1.1 C++中的内存分配 632 18.1.2 allocator类 633 18.1.3 operator new函数和 operator delete函数 636 18.1.4 定位new表达式 638 18.1.5 显式析构函数的调用 639 18.1.6 类特定的new和delete 639 18.1.7 一个内存分配器基类 641 18.2 运行时类型识别 646 18.2.1 dynamic_cast操作符 647 18.2.2 typeid操作符 649 18.2.3 RTTI的使用 650 18.2.4 type_info类 652 18.3 类成员的指针 653 18.3.1 声明成员指针 653 18.3.2 使用类成员的指针 655 18.4 嵌套类 658 18.4.1 嵌套类的实现 658 18.4.2 嵌套类作用域中的名字查找 661 18.5 联合:节省空间的类 662 18.6 局部类 665 18.7 固有的不可移植的特征 666 18.7.1 位域 666 18.7.2 volatile限定符 668 18.7.3 链接指示:extern "C" 669 小结 672 术语 673 附录 标准库 675 索引 703
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值