C++标准库

书名:C++标准库自学教程与参考手册
作者:[德]NicolaiM·Josuttis
译者:
ISBN:9787115296870
出版社:人民邮电出版社
出版时间:2012-12-19
格式:epub/mobi/azw3/pdf
页数:1099
豆瓣评分: 9.1

书籍简介:

《c++标准库——自学教程与参考手册(第2版)英文版(上、下册)》第1版自1999年出版以来便享誉全球,并一跃成为c++领域的经典畅销图书。在13年之后的今天,本书仍然被广大c++程序员奉为“案头必备的c++参考手册”并不时拜读。 《c++标准库——自学教程与参考手册(第2版)英文版(上、下册)》在第1版的基础上,全面囊括了c++11新标准中的库组件,为每个库组件提供 了详细全面的文档;介绍了各个库组件的用途和设计;清晰解释了复杂的概念;阐述了高效使用c++标注库所需要的实用编程细节、陷阱和缺陷;大部分重要类和函数的精确签名(signature)和定义;此外还包含了大量的代码示例。本书重点讲解了标准模板库(stl)其中包括检查容器、迭代器、函数对象和stl算法。本书还讲解了新的c++编程风格以该风格及对标准库的影响,其中包括lambda、基于范围的for循环,移动语义和可变参数模板。 由于本书主要以介绍c++标准库的库组件为主,因此读者需具备类、继承、异常处理和名称空间等c++语言的基本概念。具有c++编程经验的中高级程序员也可以将本书作为c++标准库的自学教程和参考手册,从而开发出高质量的c++程序。对c++ stl感兴趣的其他编程人员也可以从本书中获益。

作者简介:

Nicolai M.Josuttis,著有《C++标准库》和《C++模板》,两书都由Addison-Wesley出版。他的职务是系统架构师和技术经理。最近两年,他在一家国际电话公司中全面推广SOA。Nicolai在几个会议上办过SOA讲座,多年来他一直在发表关于这个主题的演讲。

侯俊杰(1961年9月28日-),笔名侯捷,台湾知名电脑技术专栏作家,致力于电脑技术之扎根工作,文章兼具科技之长与灵性之美[1],有读者的评语是“比作家更工程师,比工程师更作家”。大同国中、师大附中、交通大学土木系毕业、清华大学动力机械研究所硕士。曾任职工研院机械所与电通所,曾在元智大学授课,近年来多从事两岸学术交流工作。他的妻子美静是一名钢琴师,侯俊杰说他自己“嗜咖啡。妻严不能常得。”

书友短评:

@ hujianglang C++就像是一门造轮子专用的,介于底层与应用层的之间的程序设计语言。考虑到今后可能不会是我主力使用的语言,就当成辅助技能点那样,字典书式地快速翻了一遍。主要是看了例子,同时认真做好笔记,把书中的表格/源码记在电子笔记上。看了才知道C++的STL暗含了如此多以前未知的特性,主要熟悉了algorithm、iterator、constructor、allocator以及其他常用特性与库。这些看得较细。而像是模板元编程、并行等目前难以掌握的特性就快速翻过。听说C++还有个准标准库booster,这就不打算深入学习了,还有其他知识需要补上,耗太长时间在这上面觉得没必要,学无止境。 @ hujianglang 看完的第一本全英文技术书籍,算是一个突破了,接下来会阅读更多英文书籍和文档。说说这本书:1,简单易懂。2,如果不看,还真不知道C++的好多特性都没有用过。现在公司项目中的很多代码也没有用到c++11的特性,都还在用c98的特性,比较过时了。另一方面也说明,大部分人是很难更上技术进步的,也很难持续学习。 @ uqwl 知道标准库提供了什么,能干什么,具体要用了再回来查。

1 about this book 1
1.1 whythisbook 1
1.2 before reading this book 2
1.3 style and structure of the book 2
1.4 howtoreadthisbook 4
1.5 stateof theart 5
1.6 example code and additional information 5
1.7 feedback 5
2 introduction to c++ and the standard library 7
2.1 history of thec++standards 7
2.1.1 common questions about the c++11 standard 8
2.1.2 compatibility between c++98 and c++11 9
2.2 complexity and big-o notation 10
3 new language features 13
3.1 new c++11 language features 13
3.1.1 important minor syntax cleanups 13
3.1.2 automatic type deduction with auto 14
3.1.3 uniform initialization and initializer lists 15
3.1.4 range-based for loops 17
.3.1.5 move semantics and rvalue references 19
3.1.6 newstringliterals 23
3.1.7 keyword noexcept 24
3.1.8 keyword constexpr 26
3.1.9 newtemplatefeatures 26
3.1.10 lambdas 28
3.1.11 keyword decltype 32
3.1.12 new function declaration syntax 32
3.1.13 scoped enumerations 32
3.1.14 new fundamental data types 33
3.2 old “new” language features 33
3.2.1 explicit initialization for fundamental types 37
3.2.2 definition of main() 37
4 general concepts 39
4.1 namespace std 39
4.2 headerfiles 40
4.3 error and exception handling 41
4.3.1 standard exception classes 41
4.3.2 members of exception classes 44
4.3.3 passing exceptions with class exception_ptr 52
4.3.4 throwing standard exceptions 53
4.3.5 deriving from standard exception classes 54
4.4 callableobjects 54
4.5 concurrency and multithreading 55
4.6 allocators 57
5 utilities 59
5.1 pairs and tuples 60
5.1.1 pairs 60
5.1.2 tuples 68
5.1.3 i/o for tuples 74
5.1.4 conversions between tuples and pairs 75
5.2 smart pointers 76
5.2.1 class shared_ptr 76
5.2.2 class weak_ptr 84
5.2.3 misusing shared pointers 89
5.2.4 shared and weak pointers in detail 92
5.2.5 class unique_ptr 98
5.2.6 class unique_ptr indetail 110
5.2.7 class auto_ptr 113
5.2.8 final words on smart pointers 114
5.3 numericlimits 115
5.4 type traits and type utilities 122
5.4.1 purposeoftypetraits 122
5.4.2 typetraits indetail 125
5.4.3 referencewrappers 132
5.4.4 function type wrappers 133
5.5 auxiliary functions 134
5.5.1 processing the minimum and maximum 134
5.5.2 swapping two values 136
5.5.3 supplementary comparison operators 138
5.6 compile-time fractional arithmetic with class ratio[] 140
5.7 clocks andtimers 143
5.7.1 overviewof thechronolibrary 143
5.7.2 durations 144
5.7.3 clocks and timepoints 149
5.7.4 date and time functions by c and posix 157
5.7.5 blocking with timers 160
5.8 header files [cstddef], [cstdlib], and [cstring] 161
5.8.1 definitions in [cstddef] 161
5.8.2 definitions in [cstdlib] 162
5.8.3 definitions in [cstring] 163
6 the standard template library 165
6.1 stl components 165
6.2 containers 167
6.2.1 sequence containers 169
6.2.2 associative containers 177
6.2.3 unordered containers 180
6.2.4 associativearrays 185
6.2.5 other containers 187
6.2.6 container adapters 188
6.3 iterators 188
6.3.1 further examples of using associative and unordered containers 193
6.3.2 iteratorcategories 198
6.4 algorithms 199
6.4.1 ranges 203
6.4.2 handling multiple ranges 207
6.5 iteratoradapters 210
6.5.1 insert iterators 210
6.5.2 streamiterators 212
6.5.3 reverse iterators 214
6.5.4 move iterators 216
6.6 user-defined generic functions 216
6.7 manipulating algorithms 217
6.7.1 “removing” elements 218
6.7.2 manipulating associative and unordered containers 221
6.7.3 algorithms versus member functions 223
6.8 functions as algorithm arguments 224
6.8.1 using functions as algorithm arguments 224
6.8.2 predicates 226
6.9 usinglambdas 229
6.10 function objects 233
6.10.1 definition of function objects 233
6.10.2 predefined function objects 239
6.10.3 binders 241
6.10.4 function objects and binders versus lambdas 243
6.11 container elements 244
6.11.1 requirements for container elements 244
6.11.2 value semantics or reference semantics 245
6.12 errors and exceptions inside the stl 245
6.12.1 error handling 246
6.12.2 exception handling 248
6.13 extending the stl 250
6.13.1 integrating additional types 250
6.13.2 deriving from stl types 251
7 stl containers 253
7.1 common container abilities and operations 254
7.1.1 container abilities 254
7.1.2 container operations 254
7.1.3 container types 260
7.2 arrays 261
7.2.1 abilities of arrays 261
7.2.2 array operations 263
7.2.3 using arrays as c-style arrays 267
7.2.4 exception handling 268
7.2.5 tuple interface 268
7.2.6 examplesofusingarrays 268
7.3 vectors 270
7.3.1 abilities of vectors 270
7.3.2 vector operations 273
7.3.3 using vectors as c-style arrays 278
7.3.4 exception handling 278
7.3.5 examplesofusingvectors 279
7.3.6 class vector[bool] 281
7.4 deques 283
7.4.1 abilities of deques 284
7.4.2 deque operations 285
7.4.3 exception handling 288
7.4.4 examplesofusingdeques 288
7.5 lists 290
7.5.1 abilities of lists 290
7.5.2 list operations 291
7.5.3 exception handling 296
7.5.4 examplesofusinglists 298
7.6 forwardlists 300
7.6.1 abilities of forward lists 300
7.6.2 forward list operations 302
7.6.3 exception handling 311
7.6.4 examplesofusingforwardlists 312
7.7 sets and multisets 314
7.7.1 abilities of sets and multisets 315
7.7.2 set and multiset operations 316
7.7.3 exception handling 325
7.7.4 examples of using sets and multisets 325
7.7.5 example of specifying the sorting criterion at runtime 328
7.8 maps and multimaps 331
7.8.1 abilities of maps and multimaps 332
7.8.2 map and multimap operations 333
7.8.3 usingmaps asassociativearrays 343
7.8.4 exception handling 345
7.8.5 examples of using maps and multimaps 345
7.8.6 example with maps, strings, and sorting criterion at runtime 351
7.9 unordered containers 355
7.9.1 abilities of unordered containers 357
7.9.2 creating and controlling unordered containers 359
7.9.3 other operations for unordered containers 367
7.9.4 thebucket interface 374
7.9.5 usingunorderedmaps asassociativearrays 374
7.9.6 exception handling 375
7.9.7 examples of using unordered containers 375
7.10 other stl containers 385
7.10.1 strings as stl containers 385
7.10.2 ordinary c-style arrays as stl containers 386
7.11 implementing reference semantics 388
7.12 when to use which container 392
8 stl container members in detail 397
8.1 type definitions 397
8.2 create, copy, and destroy operations 400
8.3 nonmodifying operations 403
8.3.1 size operations 403
8.3.2 comparison operations 404
8.3.3 nonmodifying operations for associative and unordered containers 404
8.4 assignments 406
8.5 direct element access 408
8.6 operations to generate iterators 410
8.7 inserting and removing elements 411
8.7.1 inserting single elements 411
8.7.2 inserting multiple elements 416
8.7.3 removing elements 417
8.7.4 resizing 420
8.8 special member functions for lists and forward lists 420
8.8.1 special member functions for lists (and forward lists) 420
8.8.2 special member functions for forward lists only 423
8.9 container policy interfaces 427
8.9.1 nonmodifying policy functions 427
8.9.2 modifying policy functions 428
8.9.3 bucket interface for unordered containers 429
8.10 allocator support 430
8.10.1 fundamental allocator members 430
8.10.2 constructors with optional allocator parameters 430
9 stl iterators 433
9.1 headerfiles for iterators 433
9.2 iteratorcategories 433
9.2.1 output iterators 433
9.2.2 input iterators 435
9.2.3 forwarditerators 436
9.2.4 bidirectional iterators 437
9.2.5 random-access iterators 438
9.2.6 the increment and decrement problem of vector iterators 440
9.3 auxiliary iterator functions 441
9.3.1 advance() 441
9.3.2 next() and prev() 443
9.3.3 distance() 445
9.3.4 iter_swap() 446
9.4 iteratoradapters 448
9.4.1 reverse iterators 448
9.4.2 insert iterators 454
9.4.3 streamiterators 460
9.4.4 move iterators 466
9.5 iteratortraits 466
9.5.1 writing generic functions for iterators 468
9.6 writing user-defined iterators 471
10 stl function objects and using lambdas 475
10.1 the concept of function objects 475
10.1.1 function objects as sorting criteria 476
10.1.2 function objects with internal state 478
10.1.3 the return value of for_each() 482
10.1.4 predicates versus function objects 483
10.2 predefined function objects and binders 486
10.2.1 predefined function objects 486
10.2.2 function adapters and binders 487
10.2.3 user-defined function objects for function adapters 495
10.2.4 deprecated function adapters 497
10.3 usinglambdas 499
10.3.1 lambdas versus binders 499
10.3.2 lambdas versus stateful function objects 500
10.3.3 lambdas calling global and member functions 502
10.3.4 lambdas as hash function, sorting, or equivalence criterion 504
11 stl algorithms 505
11.1 algorithm header files 505
11.2 algorithm overview 505
11.2.1 a brief introduction 506
11.2.2 classification of algorithms 506
11.3 auxiliary functions 517
11.4 the for_each() algorithm 519
11.5 nonmodifying algorithms 524
11.5.1 counting elements 524
11.5.2 minimum and maximum 525
11.5.3 searching elements 528
11.5.4 comparingranges 542
11.5.5 predicates forranges 550
11.6 modifying algorithms 557
11.6.1 copying elements 557
11.6.2 moving elements 561
11.6.3 transforming and combining elements 563
11.6.4 swapping elements 566
11.6.5 assigning new values 568
11.6.6 replacingelements 571
11.7 removing algorithms 575
11.7.1 removing certain values 575
11.7.2 removing duplicates 578
11.8 mutating algorithms 583
11.8.1 reversingtheorderofelements 583
11.8.2 rotating elements 584
11.8.3 permuting elements 587
11.8.4 shufflingelements 589
11.8.5 moving elements to the front 592
11.8.6 partition into two subranges 594
11.9 sorting algorithms 596
11.9.1 sorting all elements 596
11.9.2 partial sorting 599
11.9.3 sorting according to the nthelement 602
11.9.4 heap algorithms 604
11.10 sorted-range algorithms 608
11.10.1 searching elements 608
11.10.2 merging elements 614
11.11 numeric algorithms 623
11.11.1 processing results 623
11.11.2 converting relative and absolute values 627
12 special containers 631
12.1 stacks 632
12.1.1 thecore interface 633
12.1.2 exampleofusingstacks 633
12.1.3 auser-definedstackclass 635
12.1.4 class stack[] indetail 637
12.2 queues 638
12.2.1 thecore interface 639
12.2.2 exampleofusingqueues 640
12.2.3 auser-definedqueueclass 641
12.2.4 class queue[] indetail 641
12.3 priorityqueues 641
12.3.1 thecore interface 643
12.3.2 exampleofusingpriorityqueues 643
12.3.3 class priority_queue[] indetail 644
12.4 container adapters in detail 645
12.4.1 type definitions 645
12.4.2 constructors 646
12.4.3 supplementary constructors for priority queues 646
12.4.4 operations 647
12.5 bitsets 650
12.5.1 examplesofusingbitsets 651
12.5.2 class bitset indetail 653
13 strings 655
13.1 purposeof thestringclasses 656
13.1.1 a first example: extracting a temporary filename 656
13.1.2 a second example: extracting words and printing them backward 660
13.2 description of the string classes 663
13.2.1 stringtypes 663
13.2.2 operation overview 666
13.2.3 constructors anddestructor 667
13.2.4 strings and c-strings 668
13.2.5 size andcapacity 669
13.2.6 element access 671
13.2.7 comparisons 672
13.2.8 modifiers 673
13.2.9 substrings and string concatenation 676
13.2.10 input/output operators 677
13.2.11 searching and finding 678
13.2.12 the value npos 680
13.2.13 numeric conversions 681
13.2.14 iterator support for strings 684
13.2.15 internationalization 689
13.2.16 performance 692
13.2.17 strings and vectors 692
13.3 stringclass indetail 693
13.3.1 type definitions and static values 693
13.3.2 create, copy, and destroy operations 694
13.3.3 operations for size and capacity 696
13.3.4 comparisons 697
13.3.5 character access 699
13.3.6 generating c-strings and character arrays 700
13.3.7 modifying operations 700
13.3.8 searching and finding 708
13.3.9 substrings and string concatenation 711
13.3.10 input/output functions 712
13.3.11 numeric conversions 713
13.3.12 generating iterators 714
13.3.13 allocator support 715
14 regular expressions 717
14.1 theregexmatch andsearchinterface 717
14.2 dealing with subexpressions 720
14.3 regex iterators 726
14.4 regextoken iterators 727
14.5 replacing regular expressions 730
14.6 regexflags 732
14.7 regex exceptions 735
14.8 theregexecmascriptgrammar 738
14.9 othergrammars 739
14.10 basic regex signatures in detail 740
15 input/output using stream classes 743
15.1 common background of i/o streams 744
15.1.1 streamobjects 744
15.1.2 streamclasses 744
15.1.3 global stream objects 745
15.1.4 streamoperators 745
15.1.5 manipulators 746
15.1.6 asimpleexample 746
15.2 fundamental stream classes and objects 748
15.2.1 classes andclasshierarchy 748
15.2.2 global stream objects 751
15.2.3 headerfiles 752
15.3 standard stream operators [[ and ]] 753
15.3.1 output operator [[ 753
15.3.2 input operator ]] 754
15.3.3 input/output of special types 755
15.4 stateofstreams 758
15.4.1 constants for thestateofstreams 758
15.4.2 member functions accessing the state of streams 759
15.4.3 stream state and boolean conditions 760
15.4.4 stream state and exceptions 762
15.5 standard input/output functions 767
15.5.1 member functions for input 768
15.5.2 member functions for output 771
15.5.3 exampleuses 772
15.5.4 sentryobjects 772
15.6 manipulators 774
15.6.1 overview of all manipulators 774
15.6.2 how manipulators work 776
15.6.3 user-defined manipulators 777
15.7 formatting 779
15.7.1 formatflags 779
15.7.2 input/output format of boolean values 781
15.7.3 field width, fill character, and adjustment 781
15.7.4 positivesignanduppercaseletters 784
15.7.5 numericbase 785
15.7.6 floating-point notation 787
15.7.7 general formatting definitions 789
15.8 internationalization 790
15.9 file access 791
15.9.1 filestreamclasses 791
15.9.2 rvalue and move semantics for file streams 795
15.9.3 fileflags 796
15.9.4 random access 799
15.9.5 using file descriptors 801
15.10 stream classes for strings 802
15.10.1 stringstreamclasses 802
15.10.2 move semantics for string streams 806
15.10.3 char*streamclasses 807
15.11 input/output operators for user-defined types 810
15.11.1 implementing output operators 810
15.11.2 implementing input operators 812
15.11.3 input/output using auxiliary functions 814
15.11.4 user-definedformatflags 815
15.11.5 conventions for user-defined input/output operators 818
15.12 connecting input and output streams 819
15.12.1 loose coupling using tie() 819
15.12.2 tight coupling using stream buffers 820
15.12.3 redirecting standard streams 822
15.12.4 streams for reading and writing 824
15.13 thestreambufferclasses 826
15.13.1 the stream buffer interfaces 826
15.13.2 streambuffer iterators 828
15.13.3 user-definedstreambuffers 832
15.14 performance issues 844
15.14.1 synchronization with c’s standard streams 845
15.14.2 bufferinginstreambuffers 845
15.14.3 usingstreambuffersdirectly 846
16 internationalization 849
16.1 character encodings and character sets 850
16.1.1 multibyte and wide-character text 850
16.1.2 differentcharactersets 851
16.1.3 dealing with character sets in c++ 852
16.1.4 charactertraits 853
16.1.5 internationalization of special characters 857
16.2 theconceptoflocales 857
16.2.1 usinglocales 858
16.2.2 locale facets 864
16.3 locales indetail 866
16.4 facets in detail 869
16.4.1 numeric formatting 870
16.4.2 monetary formatting 874
16.4.3 time and date formatting 884
16.4.4 character classification and conversion 891
16.4.5 string collation 904
16.4.6 internationalized messages 905
17 numerics 907
17.1 random numbers and distributions 907
17.1.1 afirstexample 908
17.1.2 engines 912
17.1.3 engines in detail 915
17.1.4 distributions 917
17.1.5 distributions in detail 921
17.2 complexnumbers 925
17.2.1 class complex[] ingeneral 925
17.2.2 examples using class complex[] 926
17.2.3 operations for complex numbers 928
17.2.4 class complex[] indetail 935
17.3 global numeric functions 941
17.4 valarrays 943
18 concurrency 945
18.1 the high-level interface: async() and futures 946
18.1.1 a first example using async() and futures 946
18.1.2 an example of waiting for two tasks 955
18.1.3 shared futures 960
18.2 the low-level interface: threads and promises 964
18.2.1 class std::thread 964
18.2.2 promises 969
18.2.3 class packaged_task[] 972
18.3 starting a thread in detail 973
18.3.1 async() indetail 974
18.3.2 futures in detail 975
18.3.3 shared futures in detail 976
18.3.4 class std::promise indetail 977
18.3.5 class std::packaged_task indetail 977
18.3.6 class std::thread indetail 979
18.3.7 namespace this_thread 981
18.4 synchronizing threads, or the problem of concurrency 982
18.4.1 bewareofconcurrency! 982
18.4.2 the reason for the problem of concurrent data access 983
18.4.3 what exactly can go wrong (the extent of the problem) 983
18.4.4 the features to solve the problems 987
18.5 mutexes andlocks 989
18.5.1 usingmutexes andlocks 989
18.5.2 mutexes andlocks indetail 998
18.5.3 calling once for multiple threads 1000
18.6 condition variables 1003
18.6.1 purpose of condition variables 1003
18.6.2 a first complete example for condition variables 1004
18.6.3 using condition variables to implement a queue for multiple threads 1006
18.6.4 condition variables in detail 1009
18.7 atomics 1012
18.7.1 exampleofusingatomics 1012
18.7.2 atomics and their high-level interface in detail 1016
18.7.3 the c-style interface of atomics 1019
18.7.4 thelow-level interfaceofatomics 1019
19 allocators 1023
19.1 using allocators as an application programmer 1023
19.2 auser-definedallocator 1024
19.3 usingallocators as alibraryprogrammer 1026
bibliography 1031
newsgroups and forums 1031
books and web sites 1032
index 1037
· · · · · ·

添加微信公众号:好书天下获取

添加微信公众号:“好书天下”获取书籍好书天下 » C++标准库
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!

 

添加微信公众号:“好书天下”获取书籍

添加微信公众号:“好书天下”获取书籍添加微信公众号:“好书天下”获取书籍