A Tour of C++, 2nd Edition

Book description

In A Tour of C++, Second Edition, Bjarne Stroustrup, the creator of C++, describes what constitutes modern C++. This concise, self-contained guide covers most major language features and the major standard-library components—not, of course, in great depth, but to a level that gives programmers a meaningful overview of the language, some key examples, and practical help in getting started.

Stroustrup presents the C++ features in the context of the programming styles they support, such as object-oriented and generic programming. His tour is remarkably comprehensive. Coverage begins with the basics, then ranges widely through more advanced topics, including many that are new in C++17, such as move semantics, uniform initialization, lambda expressions, improved containers, random numbers, and concurrency. The tour even covers some extensions being made for C++20, such as concepts and modules, and ends with a discussion of the design and evolution of C++.

This guide does not aim to teach you how to program (for that, see Stroustrup’s Programming: Principles and Practice Using C++, Second Edition), nor will it be the only resource you’ll need for C++ mastery (for that, see Stroustrup’s The C++ Programming Language, Fourth Edition, and recommended online sources). If, however, you are a C or C++ programmer wanting greater familiarity with the current C++ language, or a programmer versed in another language wishing to gain an accurate picture of the nature and benefits of modern C++, you can’t find a shorter or simpler introduction than this tour provides.

Table of contents

  1. Cover Page
  2. About This eBook
  3. Title Page
  4. Copyright Page
  5. Contents
  6. Preface
    1. Acknowledgments
  7. 1 The Basics
    1. 1.1 Introduction
    2. 1.2 Programs
    3. 1.3 Functions
    4. 1.4 Types, Variables, and Arithmetic
    5. 1.5 Scope and Lifetime
    6. 1.6 Constants
    7. 1.7 Pointers, Arrays, and References
    8. 1.8 Tests
    9. 1.9 Mapping to Hardware
    10. 1.10 Advice
  8. 2 User-Defined Types
    1. 2.1 Introduction
    2. 2.2 Structures
    3. 2.3 Classes
    4. 2.4 Unions
    5. 2.5 Enumerations
    6. 2.6 Advice
  9. 3 Modularity
    1. 3.1 Introduction
    2. 3.2 Separate Compilation
    3. 3.3 Modules (C++20)
    4. 3.4 Namespaces
    5. 3.5 Error Handling
    6. 3.6 Function Arguments and Return Values
    7. 3.7 Advice
  10. 4 Classes
    1. 4.1 Introduction
    2. 4.2 Concrete Types
    3. 4.3 Abstract Types
    4. 4.4 Virtual Functions
    5. 4.5 Class Hierarchies
    6. 4.6 Advice
  11. 5 Essential Operations
    1. 5.1 Introduction
    2. 5.2 Copy and Move
    3. 5.3 Resource Management
    4. 5.4 Conventional Operations
    5. 5.5 Advice
  12. 6 Templates
    1. 6.1 Introduction
    2. 6.2 Parameterized Types
    3. 6.3 Parameterized Operations
    4. 6.4 Template Mechanisms
    5. 6.5 Advice
  13. 7 Concepts and Generic Programming
    1. 7.1 Introduction
    2. 7.2 Concepts
    3. 7.3 Generic Programming
    4. 7.4 Variadic Templates
    5. 7.5 Template Compilation Model
    6. 7.6 Advice
  14. 8 Library Overview
    1. 8.1 Introduction
    2. 8.2 Standard-Library Components
    3. 8.3 Standard-Library Headers and Namespace
    4. 8.4 Advice
  15. 9 Strings and Regular Expressions
    1. 9.1 Introduction
    2. 9.2 Strings
    3. 9.3 String Views
    4. 9.4 Regular Expressions
    5. 9.5 Advice
  16. 10 Input and Output
    1. 10.1 Introduction
    2. 10.2 Output
    3. 10.3 Input
    4. 10.4 I/O State
    5. 10.5 I/O of User-Defined Types
    6. 10.6 Formatting
    7. 10.7 File Streams
    8. 10.8 String Streams
    9. 10.9 C-style I/O
    10. 10.10 File System
    11. 10.11 Advice
  17. 11 Containers
    1. 11.1 Introduction
    2. 11.2 vector
    3. 11.3 list
    4. 11.4 map
    5. 11.5 unordered_map
    6. 11.6 Container Overview
    7. 11.7 Advice
  18. 12 Algorithms
    1. 12.1 Introduction
    2. 12.2 Use of Iterators
    3. 12.3 Iterator Types
    4. 12.4 Stream Iterators
    5. 12.5 Predicates
    6. 12.6 Algorithm Overview
    7. 12.7 Concepts (C++20)
    8. 12.8 Container Algorithms
    9. 12.9 Parallel Algorithms
    10. 12.10 Advice
  19. 13 Utilities
    1. 13.1 Introduction
    2. 13.2 Resource Management
    3. 13.3 Range Checking: span
    4. 13.4 Specialized Containers
    5. 13.5 Alternatives
    6. 13.6 Allocators
    7. 13.7 Time
    8. 13.8 Function Adaption
    9. 13.9 Type Functions
    10. 13.10 Advice
  20. 14 Numerics
    1. 14.1 Introduction
    2. 14.2 Mathematical Functions
    3. 14.3 Numerical Algorithms
    4. 14.4 Complex Numbers
    5. 14.5 Random Numbers
    6. 14.6 Vector Arithmetic
    7. 14.7 Numeric Limits
    8. 14.8 Advice
  21. 15 Concurrency
    1. 15.1 Introduction
    2. 15.2 Tasks and threads
    3. 15.3 Passing Arguments
    4. 15.4 Returning Results
    5. 15.5 Sharing Data
    6. 15.6 Waiting for Events
    7. 15.7 Communicating Tasks
    8. 15.8 Advice
  22. 16 History and Compatibility
    1. 16.1 History
    2. 16.2 C++ Feature Evolution
    3. 16.3 C/C++ Compatibility
    4. 16.4 Bibliography
    5. 16.5 Advice
  23. Index
  24. Code Snippets

Product information

  • Title: A Tour of C++, 2nd Edition
  • Author(s): Bjarne Stroustrup
  • Release date: June 2018
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780134998053