具体描述
《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],有读者的评语是“比作家更工程师,比工程师更作家”。大同国中、师大附中、交通大学土木系毕业、清华大学动力机械研究所硕士。曾任职工研院机械所与电通所,曾在元智大学授课,近年来多从事两岸学术交流工作。他的妻子美静是一名钢琴师,侯俊杰说他自己“嗜咖啡。妻严不能常得。”
目录信息
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
· · · · · · (收起)
读后感
看这本书花了一个星期,对照着VC6版本的STL源码看,从什么都不知道到基本上理解了STL是什么,容器是什么有什么用,算法是干什么的等等~·…… 当然,我觉得里面的很多东西使用到的时候再去深究就可以了,比如那100多个算法,看几个基本的算法的源码理解一下就差不多了,其他的...
建议读者去学习这本书的英文版,网上有CHM电子版,英文版也通俗易懂,没有什么生涩的地方。 之所以推荐英文版的原因是本书中文版太贵了
此书在amazon.com上几乎得到了全五星的评论。800页的大部头,我大概花了一周不到的时间基本读完,并动手敲完了前10章的绝大部分demo代码。 STL的设计思想(通过迭代器将数据结构和算法分离,获得通用性的程序组件)是此书的精华。其余的部分诸如复数complex,valarray,bitset...
这确是一本让人深以为相见恨晚的C++力作. 尤其是在C++11标准已出之后才阅毕,更是对自己的后知后觉唏嘘不已. 如前有人所建议,如经济拮据,可于网上下载电子版观看. 当然,个人还是认为应该购置一本常做翻阅,厚厚的一砖头,看累了还可以就地做枕休息... ^_^ 当然了,看似近800页的...
用户评价
我必须说,这本书绝对是C++开发者案头的必备参考书!我一直在从事C++相关的开发工作,虽然工作中经常接触到标准库,但总感觉自己对其的理解不够深入,很多时候只是知其然而不知其所以然。这本书恰好弥补了我的这一不足。它不仅仅是罗列函数和类的用法,更重要的是,它深入探讨了STL背后的设计思想和实现原理。比如,它详细解释了为什么vector比list在某些情况下性能更好,为什么map和unordered_map有不同的适用场景,以及它们各自的复杂度分析。这些深层次的知识,对于我优化代码性能、做出更明智的设计决策至关重要。书中对智能指针的讲解也让我受益匪浅,我以前经常手动管理内存,容易造成内存泄漏,现在理解了unique_ptr和shared_ptr的区别和用法,大大提升了内存管理的安全性。总而言之,这本书提供了一种“知其然,更知其所以然”的学习方式,让我对C++标准库有了更宏观、更深刻的认识。
这本书简直是我学习C++以来遇到的最惊喜的“队友”!我之前一直觉得C++标准库就像一个神秘的宝藏,虽然知道它里面藏着无数好东西,但总是不得其法,很多时候只能依赖自己写轮子,效率低不说,还容易出错。但《C++标准库》这本书,就像一把金钥匙,唰地一下就打开了宝藏的大门。它的讲解清晰透彻,一点一点地把复杂的概念拆解开来,让你即使是初学者也能理解。我尤其喜欢它对STL(Standard Template Library)部分的讲解,容器(vector, list, map, set等等)的用法、迭代器的概念,还有算法库的介绍,都写得非常到位。书里大量的示例代码,都是可以直接拿来运行并修改的,这对我这种动手能力比较强的人来说,简直是福音。通过这些例子,我不仅理解了函数的功能,更学会了如何在实际项目中运用它们。以前写代码总是顾虑重重,生怕自己用了不熟悉的库函数,现在有了这本书,我感觉自信了很多,能够更从容地利用标准库来解决问题,也更加注重代码的效率和优雅。
作为一个从C转向C++的开发者,我对C++标准库最初的印象是庞大而混乱,总觉得无从下手。但《C++标准库》这本书,硬是凭着它的逻辑性和系统性,把我从迷茫中解救了出来。它不是那种堆砌知识点的书,而是循序渐进地引导读者理解每个模块的功能和设计哲学。我特别喜欢它关于I/O流的部分,cin、cout、fstream这些基础但至关重要的部分,书里给出了非常详细的解释,包括流的状态标志、格式控制等等,让我能更精细地控制程序的输入输出。另外,它对异常处理机制的讲解,也让我意识到了如何更健壮地编写C++程序,避免程序崩溃。这本书的结构设计也很合理,每一章都聚焦于一个特定的领域,让我能够根据自己的需求有针对性地学习。即使我暂时用不到某个部分,但理解它的概念,也能为日后的学习打下基础。
我一直觉得,一本好的技术书籍,不仅要传递知识,更要激发读者的学习兴趣。而《C++标准库》这本书,无疑做到了这一点。它没有枯燥的技术术语堆砌,而是用一种非常友好的方式,将C++标准库的精髓呈现在我面前。我特别喜欢它在讲解每个模块时,都会先介绍其解决的问题背景,然后引出相应的解决方案,这种方式让我觉得学习非常有目的性。例如,在讲解日期和时间处理时,它并没有直接丢给我一堆函数,而是先描述了在实际开发中,我们可能会遇到哪些日期时间相关的挑战,然后才引出`<chrono>`库,并详细介绍了其提供的各种类和函数。书中的排版也十分舒适,代码示例清晰易懂,注释也很到位,让我能够很快地理解并掌握。总而言之,这本书让我觉得学习C++标准库不再是一件枯燥乏味的事情,反而充满了探索的乐趣。
坦白说,在读这本书之前,我对C++标准库的理解仅限于一些常用的功能,比如字符串操作和基本的数据结构。然而,这本书的出现,彻底颠覆了我对标准库的认知。它就像一位经验丰富的导师,不仅告诉我“做什么”,更重要的是告诉我“怎么做”以及“为什么这么做”。书中的讲解,总是能从实际应用场景出发,引出相应的标准库特性,并辅以清晰的代码示例。我尤其欣赏它对算法库的讲解,很多复杂的算法,通过标准库提供的函数,就能轻松实现,而且性能还很高。这让我彻底告别了过去那种“自己写一个循环或者递归去实现”的低效方式。此外,它还介绍了一些我之前从未注意过但非常有用的工具,比如`<chrono>`库在时间处理方面的强大能力,以及`<random>`库在生成随机数方面的灵活性。这本书的内容涵盖面广,深度也足够,让我感觉自己对C++标准库的掌握程度又提升了一个台阶。
知道标准库提供了什么,能干什么,具体要用了再回来查。
使用指南
看完的第一本全英文技术书籍,算是一个突破了,接下来会阅读更多英文书籍和文档。说说这本书:1,简单易懂。2,如果不看,还真不知道C++的好多特性都没有用过。现在公司项目中的很多代码也没有用到c++11的特性,都还在用c98的特性,比较过时了。另一方面也说明,大部分人是很难更上技术进步的,也很难持续学习。
new feature感觉很多出自C++本身的缺陷,无论如何,一门无比复杂的语言更加复杂了。
STL C++11 很好的工具书,阅读一遍后对容器,算法有更深的理解