Book description
In C++20 for Programmers, the Deitels bring their proven Live Code approach to teaching today’s powerful new version of the C++ language. Like all Deitel Developer titles, they teach the best way possible: via hundreds of complete example C++ programs, with thousands of lines of downloadable C++ source code.
C++20 for Programmers is an introductory-through-intermediate-level, tutorial presentation of computer programming in the latest version (C++20) of the C++ programming language, which is popular for developing systems software, embedded systems programming, operating systems, real-time systems, communications systems and other high-performance computer applications. Ideal for anyone who’s worked with at least one programming language before, C++20 for Programmers utilizes a proven "early objects" approach, emphasizing program clarity, software reuse, and component-oriented software construction. In addition to the core language, it will help you take advantage of the newest standard libraries and the newest language extensions.
Table of contents
- Cover Page
- Title Page
- Copyright Page
- Contents
- Table of Contents
- Preface
-
Part 1: C++ Fundamentals Quickstart
- Chapter 1. Introduction and Test-Driving a C++ Application
-
Chapter 2. Introduction to C++ Programming
- 2.1 Introduction
- 2.2 First Program in C++: Displaying a Line of Text
- 2.3 Modifying Our First C++ Program
- 2.4 Another C++ Program: Adding Integers
- 2.5 Arithmetic
- 2.6 Decision Making: Equality and Relational Operators
- 2.7 Objects Natural: Creating and Using Objects of Standard Library Class string
- 2.8 Wrap-Up
-
Chapter 3. Control Statements, Part 1; Intro to C++20 Text Formatting
- 3.1 Introduction
- 3.2 Control Structures
- 3.3 if Single-Selection Statement
- 3.4 if…else Double-Selection Statement
- 3.5 while Iteration Statement
- 3.6 Counter-Controlled Iteration
- 3.7 Sentinel-Controlled Iteration
- 3.8 Nested Control Statements
- 3.9 Compound Assignment Operators
- 3.10 Increment and Decrement Operators
- 3.11 Fundamental Types Are Not Portable
- 3.12 Objects Natural Case Study: Arbitrary Sized Integers
- 3.13 C++20 Feature Mock-Up—Text Formatting with Function format
- 3.14 Wrap-Up
-
Chapter 4. Control Statements, Part 2
- 4.1 Introduction
- 4.2 Essentials of Counter-Controlled Iteration
- 4.3 for Iteration Statement
- 4.4 Examples Using the for Statement
- 4.5 Application: Summing Even Integers
- 4.6 Application: Compound-Interest Calculations
- 4.7 do…while Iteration Statement
- 4.8 switch Multiple-Selection Statement
- 4.9 C++17: Selection Statements with Initializers
- 4.10 break and continue Statements
- 4.11 Logical Operators
- 4.12 Confusing the Equality (==) and Assignment (=) Operators
- 4.13 C++20 Feature Mock-Up: [[likely]] and [[unlikely]] Attributes
- 4.14 Objects Natural Case Study: Using the miniz-cpp Library to Write and Read ZIP files
- 4.15 C++20 Feature Mock-Up: Text Formatting with Field Widths and Precisions
- 4.16 Wrap-Up
-
Chapter 5. Functions
- 5.1 Introduction
- 5.2 Program Components in C++
- 5.3 Math Library Functions
- 5.4 Function Definitions and Function Prototypes
- 5.5 Order of Evaluation of a Function’s Arguments
- 5.6 Function-Prototype and Argument-Coercion Notes
- 5.7 C++ Standard Library Headers
- 5.8 Case Study: Random-Number Generation
- 5.9 Case Study: Game of Chance; Introducing Scoped enums
- 5.10 C++11’s More Secure Nondeterministic Random Numbers
- 5.11 Scope Rules
- 5.12 Inline Functions
- 5.13 References and Reference Parameters
- 5.14 Default Arguments
- 5.15 Unary Scope Resolution Operator
- 5.16 Function Overloading
- 5.17 Function Templates
- 5.18 Recursion
- 5.19 Example Using Recursion: Fibonacci Series
- 5.20 Recursion vs. Iteration
- 5.21 C++17 and C++20: [[nodiscard]] Attribute
- 5.22 Lnfylun Lhqtomh Wjtz Qarcv: Qjwazkrplm xzz Xndmwwqhlz
- 5.23 Wrap-Up
-
Part 2: Arrays, Pointers, Strings and Files
-
Chapter 6. arrays, vectors, C++20 Ranges and Functional-Style Programming
- 6.1 Introduction
- 6.2 arrays
- 6.3 Declaring arrays
- 6.4 Initializing array Elements in a Loop
- 6.5 Initializing an array with an Initializer List
- 6.6 C++1 1 Range-Based for and C++20 Range-Based for with Initializer
- 6.7 Setting array Elements with Calculations; Introducing constexpr
- 6.8 Totaling array Elements
- 6.9 Using a Primitive Bar Chart to Display array Data Graphically
- 6.10 Using array Elements as Counters
- 6.11 Using arrays to Summarize Survey Results
- 6.12 Sorting and Searching arrays
- 6.13 Multidimensional arrays
- 6.14 Intro to Functional-Style Programming
- 6.15 Objects Natural Case Study: C++ Standard Library Class Template vector
- 6.16 Wrap-Up
-
Chapter 7. (Downplaying) Pointers in Modern C++
- 7.1 Introduction
- 7.2 Pointer Variable Declarations and Initialization
- 7.3 Pointer Operators
- 7.4 Pass-by-Reference with Pointers
- 7.5 Built-In Arrays
- 7.6 C++20: Using to_array to convert a Built-in Array to a std::array
- 7.7 Using const with Pointers and the Data They Point To
- 7.8 sizeof Operator
- 7.9 Pointer Expressions and Pointer Arithmetic
- 7.10 Objects Natural Case Study: C++20 spans—Views of Contiguous Container Elements
- 7.11 A Brief Intro to Pointer-Based Strings
- 7.12 Looking Ahead to Other Pointer Topics
- 7.13 Wrap-Up
-
Chapter 8. strings, string_views, Text Files, CSV Files and Regex
- 8.1 Introduction
- 8.2 string Assignment and Concatenation
- 8.3 Comparing strings
- 8.4 Substrings
- 8.5 Swapping strings
- 8.6 string Characteristics
- 8.7 Finding Substrings and Characters in a string
- 8.8 Replacing Characters in a string
- 8.9 Inserting Characters into a string
- 8.10 C++11 Numeric Conversions
- 8.11 C++17 string_view
- 8.12 Files and Streams
- 8.13 Creating a Sequential File
- 8.14 Reading Data from a Sequential File
- 8.15 C++14 Reading and Writing Quoted Text
- 8.16 Updating Sequential Files
- 8.17 String Stream Processing
- 8.18 Raw String Literals
- 8.19 Objects Natural Case Study: Reading and Analyzing a CSV File Containing Titanic Disaster Data
- 8.20 Objects Natural Case Study: Introduction to Regular Expressions
- 8.21 Wrap-Up
-
Chapter 6. arrays, vectors, C++20 Ranges and Functional-Style Programming
-
Part 3: Object-Oriented Programming
-
Chapter 9. Custom Classes
- 9.1 Introduction
- 9.2 Test-Driving an Account Object
- 9.3 Account Class with a Data Member and Set and Get Member Functions
- 9.4 Account Class: Custom Constructors
- 9.5 Software Engineering with Set and Get Member Functions
- 9.6 Account Class with a Balance
- 9.7 Time Class Case Study: Separating Interface from Implementation
- 9.8 Compilation and Linking Process
- 9.9 Class Scope and Accessing Class Members
- 9.10 Access Functions and Utility Functions
- 9.11 Time Class Case Study: Constructors with Default Arguments
- 9.12 Destructors
- 9.13 When Constructors and Destructors Are Called
- 9.14 Time Class Case Study: A Subtle Trap—Returning a Reference or a Pointer to a private Data Member
- 9.15 Default Assignment Operator
- 9.16 const Objects and const Member Functions
- 9.17 Composition: Objects as Members of Classes
- 9.18 friend Functions and friend Classes
- 9.19 The this Pointer
- 9.20 static Class Members—Classwide Data and Member Functions
- 9.21 Aggregates in C++20
- 9.22 Objects Natural Case Study: Serialization with JSON
- 9.23 Wrap-Up
-
Chapter 10. OOP: Inheritance and Runtime Polymorphism
- 10.1 Introduction
- 10.2 Base Classes and Derived Classes
- 10.3 Relationship between Base and Derived Classes
- 10.4 Constructors and Destructors in Derived Classes
- 10.5 Intro to Runtime Polymorphism: Polymorphic Video Game
- 10.6 Relationships Among Objects in an Inheritance Hierarchy
- 10.7 Virtual Functions and Virtual Destructors
- 10.8 Abstract Classes and Pure virtual Functions
- 10.9 Case Study: Payroll System Using Runtime Polymorphism
- 10.10 Runtime Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood”
- 10.11 Non-Virtual Interface (NVI) Idiom
- 10.12 Program to an Interface, Not an Implementation
- 10.13 Runtime Polymorphism with std::variant and std::visit
- 10.14 Multiple Inheritance
- 10.15 protected Class Members
- 10.16 public, protected and private Inheritance
- 10.17 Wrap-Up
-
Chapter 11. Operator Overloading, Copy/Move Semantics and Smart Pointers
- 11.1 Introduction
- 11.2 Using the Overloaded Operators of Standard Library Class string
- 11.3 Operator Overloading Fundamentals
- 11.4 (Downplaying) Dynamic Memory Management with new and delete
- 11.5 Modern C++ Dynamic Memory Management—RAII and Smart Pointers
- 11.6 MyArray Case Study: Crafting a Valuable Class with Operator Overloading
- 11.7 C++20 Three-Way Comparison Operator (<=>)
- 11.8 Converting Between Types
- 11.9 explicit Constructors and Conversion Operators
- 11.10 Overloading the Function Call Operator ()
- 11.11 Wrap-Up
-
Chapter 12. Exceptions and a Look Forward to Contracts
- 12.1 Introduction
- 12.2 Exception-Handling Flow of Control; Defining an Exception Class
- 12.3 Exception Safety Guarantees and noexcept
- 12.4 Rethrowing an Exception
- 12.5 Stack Unwinding and Uncaught Exceptions
- 12.6 When to Use Exception Handling
- 12.7 Constructors, Destructors and Exception Handling
- 12.8 Processing new Failures
- 12.9 Standard Library Exception Hierarchy
- 12.10 C++’s Alternative to the finally Block
- 12.11 Libraries Often Support Both Exceptions and Error Codes
- 12.12 Logging
- 12.13 Looking Ahead to Contracts
- 12.14 Wrap-Up
-
Chapter 9. Custom Classes
-
Part 4: Standard Library Containers, Iterators and Algorithms
-
Chapter 13. Standard Library Containers and Iterators
- 13.1 Introduction
- 13.2 Introduction to Containers
- 13.3 Working with Iterators
- 13.4 A Brief Introduction to Algorithms
- 13.5 Sequence Containers
- 13.6 vector Sequence Container
- 13.7 list Sequence Container
- 13.8 deque Sequence Container
- 13.9 Associative Containers
- 13.10 Container Adaptors
- 13.11 bitset Near Container
- 13.12 Optional: A Brief Intro to Big O
- 13.13 Optional: A Brief Intro to Hash Tables
- 13.14 Wrap-Up
-
Chapter 14. Standard Library Algorithms and C++20 Ranges & Views
- 14.1 Introduction
- 14.2 Algorithm Requirements: C++20 Concepts
- 14.3 Lambdas and Algorithms
- 14.4 Algorithms
- 14.5 Function Objects (Functors)
- 14.6 Projections
- 14.7 C++20 Views and Functional-Style Programming
- 14.8 Intro to Parallel Algorithms
- 14.9 Standard Library Algorithm Summary
- 14.10 A Look Ahead to C++23 Ranges
- 14.11 Wrap-Up
-
Chapter 13. Standard Library Containers and Iterators
-
Part 5: Advanced Topics
-
Chapter 15. Templates, C++20 Concepts and Metaprogramming
- 15.1 Introduction
- 15.2 Custom Class Templates and Compile-Time Polymorphism
- 15.3 C++20 Function Template Enhancements
- 15.4 C++20 Concepts: A First Look
- 15.5 Type Traits
- 15.6 C++20 Concepts: A Deeper Look
- 15.7 Testing C++20 Concepts with static_assert
- 15.8 Creating a Custom Algorithm
- 15.9 Creating a Custom Container and Iterators
- 15.10 Default Arguments for Template Type Parameters
- 15.11 Variable Templates
- 15.12 Variadic Templates and Fold Expressions
- 15.13 Template Metaprogramming
- 15.14 Wrap-Up
-
Chapter 16. C++20 Modules: Large-Scale Development
- 16.1 Introduction
- 16.2 Compilation and Linking Prior to C++20
- 16.3 Advantages and Goals of Modules
- 16.4 Example: Transitioning to Modules—Header Units
- 16.5 Example: Creating and Using a Module
- 16.6 Global Module Fragment
- 16.7 Separating Interface from Implementation
- 16.8 Partitions
- 16.9 Additional Modules Examples
- 16.10 Modules Can Reduce Translation Unit Sizes and Compilation Times
- 16.11 Migrating Code to Modules
- 16.12 Future of Modules and Modules Tooling
- 16.13 Wrap-Up
- Chapter 17. Concurrent Programming; Intro to C++20 Coroutines [This content is currently in development.]
-
Chapter 15. Templates, C++20 Concepts and Metaprogramming
- Part 6: Other Topics
-
Part 7: Appendices
- Appendix A: Operator Precedence and Grouping [This content is currently in development.]
- Appendix B: Character Set [This content is currently in development.]
- Appendix C: Fundamental Types [This content is currently in development.]
- Appendix D: Number Systems [This content is currently in development.]
- Appendix E: Preprocessor [This content is currently in development.]
- Appendix F: Bits, Characters, C Strings and structs [This content is currently in development.]
- Appendix G: C Legacy Code Topics [This content is currently in development.]
- Appendix H: Using the Visual Studio Debugger [This content is currently in development.]
- Appendix I: Using the GNU C++ Debugger [This content is currently in development.]
- Appendix J: Using the Xcode Debugger [This content is currently in development.]
- Code Snippets
Product information
- Title: C++20 for Programmers, 3rd Edition
- Author(s):
- Release date: November 2020
- Publisher(s): Pearson
- ISBN: 9780136905776
You might also like
book
Clean Code: A Handbook of Agile Software Craftsmanship
Even bad code can function. But if code isn’t clean, it can bring a development organization …
video
Ultimate Go Programming, Second Edition
An updated edition of this video title is available. Please go to Ultimate Go: Advanced Concepts …
book
Programming Rust, 2nd Edition
Systems programming provides the foundation for the world's computation. Writing performance-sensitive code requires a programming language …
book
Head First Design Patterns, 2nd Edition
What will you learn from this book? You know you don't want to reinvent the wheel, …