The C++ Standard Library (2nd Edition) cover

The C++ Standard Library (2nd Edition)

Rating 4.8
Word count
1.5M words
Chapters
40
ISBN
9787121260896

Tags

Summary

This book is the Simplified Chinese translation of Nicolai M. Josuttis's The C++ Standard Library: A Tutorial and Reference, Second Edition, translated by Hou Jie. It is one of the most widely circulated authoritative reference works on the standard library in the global C++ community. The first edition was published in 1999; twelve years later, the second edition was comprehensively rewritten to the C++11 standard. Nearly 1,100 pages long, with all example code rewritten in C++11. The book unfolds in a dual structure of tutorial plus reference manual: it first introduces the history of the C++ Standard and complexity and Big-O notation, then systematically surveys the new language features brought by C++11, including auto type deduction, uniform initialization and initializer lists, range-based for loops, move semantics and rvalue references, noexcept, constexpr, variadic templates, lambda expressions, decltype, the new function declaration syntax, and scoped enumerations, and analyzes the compatibility differences between C++98 and C++11. The main body focuses on the Standard Template Library (STL): containers, container member functions, iterators, function objects and lambdas, and STL algorithms, explaining for each component its design purpose, usage, common pitfalls, and performance costs; it then covers special containers, strings, regular expressions, I/O with streams, internationalization, numerics (including random numbers and complex numbers), concurrency (threads, mutexes, condition variables, future and async, etc.), allocators, and general utilities such as smart pointers, tuple, type traits, and clocks and timers. For every component the book provides runnable example code and also specifies its exact semantics and the boundaries where misuse is easy, making it suitable as a desk reference for consultation.

Editor's review

“不熟悉C++标准库,任何人都称不上是高效的C++程序员。”侯捷在推荐语中的这句话,恰好说明了这本书的地位。它不是又一本讲语法的入门书,而是把标准库从“会用”推进到“用对、用巧”的那本关键参考书。 它与市面上不少近似标准草案翻译的读物不同:Josuttis本人曾是C++标准委员会库工作小组成员,书中对每个组件的设计意图、复杂度代价、接口语义和常见误用都讲得很具体,很多“踩过坑才知道”的细节被直接写进了正文。第二版更是彻底的改写,全书示例代码按C++11重写,move语义、lambda、range-based for、并发组件、正则、智能指针、type traits、随机数等内容都不是附录式补充,而是融入各章的正式讲解;同时专门剖析C++98与C++11的差异,对从旧标准迁移过来的开发者尤其友好。 侯捷的译本在术语处理上比较克制,关键概念尽量保留英文原名并附中文解释,查阅时不易出现“知道中文找不到对应英文”的错位感。1100页的体量看起来吓人,但它的编排本身就是为“查”而设计的:每章自洽,小节标题细,索引齐全,完全可以不按顺序读。 需要提醒的是,本书对应的是C++11。C++14/17/20之后标准库又有大量扩充(文件系统、string_view、optional、ranges、格式化库等),本书没有覆盖,读时最好配合cppreference等在线文档对照使用。它不是入门书,但一旦你写起了真正的项目,它很可能成为你翻得最旧的那本。

Who it's for

A good fit for

  • 已掌握C++语法、需要系统掌握标准库的中级开发者
  • 日常写C++项目,需要一本可随时查阅的案头参考书的工程师
  • 从C++98/03迁移到C++11,想理清move语义、lambda等变化的老手
  • 准备面试或技术考核,需要吃透STL容器、算法、迭代器细节的求职者
  • 高校C++相关课程中需要扩展阅读材料的学生

Not a good fit for

  • 完全没写过C++、需要从变量和循环开始学的零基础读者
  • 只想快速做一个小demo,不打算深入理解标准库语义的人
  • 主攻C++17/20/23新特性、想要一本覆盖最新标准的读者

Reading tips

  1. 先读第1—3章建立C++11语言新特性的全局认识,再按需跳读STL各章。
  2. 把它当手册:写代码遇到容器、算法、并发问题时按索引定向查阅,而不是通读。
  3. 亲手敲一遍书中的关键示例并改动参数观察行为,尤其留意各组件标注的陷阱与复杂度。
  4. 对照cppreference等在线文档同步更新,明确本书只覆盖到C++11这一范围。

About the publisher

Publishing House of Electronics Industry China · Founded in 1982

The Publishing House of Electronics Industry is a comprehensive publisher distinguished by its focus on electronic information and related fields. Judging from the more than 3,000 titles in its catalogue, its publishing covers programming and design, artificial intelligence, computer science, finance and economics, photography, and social sciences, attending both to cutting-edge technology and to general readers. Representative titles include Factor Investing: Methods and Practice, x86 Assembly Language: From Real Mode to Protected Mode, The RISC-V Reader, Artificial Intelligence: Speech Recognition, Understanding and Practice, Phased Array Radar Technology, Radar Target Characteristics, and 100 Go Mistakes and How to Avoid Them, most of which centre on technical methods and engineering practice. Its authors include Shi Chuan, Li Zhong, Wang Xiaobo, David Patterson, Andrew Waterman, and Yu Zihao, among others from China and abroad. Owing to limited public information, no further publishing features are elaborated here.

Contents

  1. Preface to the Second Edition
  2. Preface to the Second Edition
  3. Acknowledgments for the Second Edition
  4. Preface to the First Edition
  5. Acknowledgments for the First Edition
  6. 1 About This Book
  7. 1.1 Origins
  8. 1.2 Prerequisites for Reading
  9. 1.3 Style and Structure of the Book
  10. 1.4 How to Read This Book
  11. 1.5 Current State of Affairs
  12. 1.6 Example Code and Additional Information
  13. 1.7 Feedback
  14. 2 Introduction to C++ and the Standard Library
  15. 2.1 History of the C++ Standard
  16. 2.1.1 Common Questions about the C++11 Standard
  17. 2.1.2 Compatibility between C++98 and C++11
  18. 2.2 Complexity and Big-O Notation
  19. 3 New Language Features
  20. 3.1 New C++11 Language Features
  21. 3.1.1 Minor but Important Syntax Improvements
  22. 3.1.2 Automatic Type Deduction with auto
  23. 3.1.3 Uniform Initialization and Initializer Lists
  24. 3.1.4 Range-Based for Loops
  25. 3.1.5 Move Semantics and Rvalue References
  26. 3.1.6 New String Literals
  27. 3.1.7 The noexcept Keyword
  28. 3.1.8 The constexpr Keyword
  29. 3.1.9 Brand-New Template Features
  30. 3.1.10 Lambda
  31. 3.1.11 The decltype Keyword
  32. 3.1.12 New Function Declaration Syntax
  33. 3.1.13 Scoped Enumerations
  34. 3.1.14 New Fundamental Data Types
  35. 3.2 Old but Still New Language Features
  36. 3.2.1 Explicit Initialization for Fundamental Types
  37. 3.2.2 Definition of main()
  38. 4 General Concepts
  39. 5 General Utilities
  40. 6 The Standard Template Library

FAQ

这本书适合C++初学者吗?
不太适合零基础读者。书中默认读者已掌握类、模板、指针等C++基本语法,直接从标准库组件的设计意图讲起。建议先用《C++ Primer》一类书打基础,再读本书效率更高。
第2版与第1版有什么区别?
第2版基于C++11标准全面重写,示例代码全部改为C++11风格,并新增move语义、lambda、range-based for、并发、正则表达式、智能指针、type traits、随机数等章节;第1版只覆盖C++98/03。
本书覆盖到哪个C++标准?
主要内容对应C++11。文件系统、string_view、optional、ranges等C++17/20引入的组件不在本书范围内,使用时需配合最新在线文档。
中文版由谁翻译,质量如何?
简体中文版由侯捷翻译,术语处理较为严谨,关键概念常保留英文原名并附中文解释,便于对照官方文档和英文资料查阅。
这本书需要按顺序读完吗?
不必。全书章节相对独立,可先读第1—3章了解语言新特性和阅读方法,之后按项目需要直接查阅容器、算法、字符串、I/O、并发等对应章节。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category