
Lýsing:
C++ How to Program: An Objects-Natural Approach is a code-intensive, modular introduction to C++ programming. The Deitel live-code approach presents concepts using full working programs rather than code snippets so that you can immediately start to run programs as you read. Interesting, entertaining and challenging examples, exercises and projects help you see how what you're learning applies to real-world scenarios.
Annað
- Höfundar: Paul Deitel, Harvey Deitel & Associates
- Útgáfa:11
- Útgáfudagur: 2024-12-02
- Hægt að prenta út 2 bls.
- Hægt að afrita 2 bls.
- Format:ePub
- ISBN 13: 9781292728216
- Print ISBN: 9781292460000
- ISBN 10: 1292728213
Efnisyfirlit
- Cover
- Inside Front Cover
- Welcome
- Full Title Page
- Copyright Page
- Dedication
- Preface
- 1 An Innovative Modern C++ Programming Textbook
- 2 Modern C++
- 3 Target Audiences
- 4 “Objects-Natural” Learning Approach
- 5 Programming Wisdom and Key C++20 Features
- 6 Tour of the Book
- 7 Compilers, Docker and Static Code Analysis Tools
- 8 Thinking Like a Developer—GitHub, StackOverflow and More
- 9 Computing and Data Science Curricula
- 10 Data Science Overlaps with Computer Science
- 11 Web-Based Materials
- 12 C++ Core Guidelines
- 13 Pedagogic Features and Conventions
- 14 Instructor Supplements
- 15 Some Key C++ Documentation and Resources
- 16 Getting Your Questions Answered
- 17 Join the Deitel & Associates, Inc. Social Media Communities
- 18 Live Instructor-Led Training with Paul Deitel
- 19 Acknowledgments
- 20 About the Authors
- 21 About Deitel® & Associates, Inc.
- Before You Begin
- Before You Begin
- 1: Intro to Computers and C++
- 1: Objectives
- 1.1: Introduction
- 1.1: Introduction
- 1.2: Hardware
- 1.2: Hardware
- 1.2.1: Computer Organization
- 1.2.1: Computer Organization
- 1.2.2: Moore’s Law, Multi-Core Processors and Concurrent Programming
- 1.2.2: Moore’s Law, Multi-Core Processors and Concurrent Programming
- 1.3: Data Hierarchies
- 1.3: Data Hierarchies
- 1.4: Machine Languages, Assembly Languages and High-Level Languages
- 1.4: Machine Languages, Assembly Languages and High-Level Languages
- 1.5: Operating Systems
- 1.5: Operating Systems
- 1.6: C and C++
- 1.6: C and C++
- 1.7: C++ Standard Library and Open-Source Libraries
- 1.7: C++ Standard Library and Open-Source Libraries
- 1.8: Other Popular Programming Languages
- 1.8: Other Popular Programming Languages
- 1.9: Introduction to Object Orientation
- 1.9: Introduction to Object Orientation
- 1.10: Simplified View of a C++ Development Environment
- 1.10: Simplified View of a C++ Development Environment
- 1.11: Test-Driving a C++20 Application Various Ways
- 1.11: Test-Driving a C++20 Application Various Ways
- 1.11.1: Compiling and Running on Windows with Visual Studio Community Edition
- 1.11.1: Compiling and Running on Windows with Visual Studio Community Edition
- 1.11.2: Compiling and Running with GNU C++ on Linux
- 1.11.2: Compiling and Running with GNU C++ on Linux
- 1.11.3: Compiling and Running with g++ in the GCC Docker Container
- 1.11.3: Compiling and Running with g++ in the GCC Docker Container
- 1.11.4: Compiling and Running with clang++ in a Docker Container
- 1.11.4: Compiling and Running with clang++ in a Docker Container
- 1.11.5: Compiling and Running with Xcode on macOS
- 1.11.5: Compiling and Running with Xcode on macOS
- 1.12: Internet, World Wide Web, the Cloud and IoT
- 1.12: Internet, World Wide Web, the Cloud and IoT
- 1.12.1: The Internet: A Network of Networks
- 1.12.1: The Internet: A Network of Networks
- 1.12.2: The World Wide Web: Making the Internet User-Friendly
- 1.12.2: The World Wide Web: Making the Internet User-Friendly
- 1.12.3: The Cloud
- 1.12.3: The Cloud
- 1.12.4: The Internet of Things (IoT)
- 1.12.4: The Internet of Things (IoT)
- 1.12.5: Edge Computing
- 1.12.5: Edge Computing
- 1.12.6: Mashups
- 1.12.6: Mashups
- 1.13: Metaverse
- 1.13: Metaverse
- 1.13.1: Virtual Reality (VR)
- 1.13.1: Virtual Reality (VR)
- 1.13.2: Augmented Reality (AR)
- 1.13.2: Augmented Reality (AR)
- 1.13.3: Mixed Reality
- 1.13.3: Mixed Reality
- 1.13.4: Blockchain
- 1.13.4: Blockchain
- 1.13.5: Bitcoin and Cryptocurrency
- 1.13.5: Bitcoin and Cryptocurrency
- 1.13.6: Ethereum
- 1.13.6: Ethereum
- 1.13.7: Non-Fungible Tokens (NFTs)
- 1.13.7: Non-Fungible Tokens (NFTs)
- 1.13.8: Web3
- 1.13.8: Web3
- 1.14: Software Development Technologies
- 1.14: Software Development Technologies
- 1.15: How Big Is Big Data?
- 1.15: How Big Is Big Data?
- 1.15.1: Big-Data Analytics
- 1.15.1: Big-Data Analytics
- 1.15.2: Data Science and Big Data Are Making a Difference: Use Cases
- 1.15.2: Data Science and Big Data Are Making a Difference: Use Cases
- 1.16: AI—at the Intersection of Computer Science and Data Science
- 1.16: AI—at the Intersection of Computer Science and Data Science
- 1.16.1: Artificial Intelligence (AI)
- 1.16.1: Artificial Intelligence (AI)
- 1.16.2: Artificial General Intelligence (AGI)
- 1.16.2: Artificial General Intelligence (AGI)
- 1.16.3: Artificial Intelligence Milestones
- 1.16.3: Artificial Intelligence Milestones
- 1.16.4: Machine Learning
- 1.16.4: Machine Learning
- 1.16.5: Deep Learning
- 1.16.5: Deep Learning
- 1.16.6: Reinforcement Learning
- 1.16.6: Reinforcement Learning
- 1.16.7: Generative AI—ChatGPT and Dall-E 2
- 1.16.7: Generative AI—ChatGPT and Dall-E 2
- 1.17: Wrap-Up
- 1.17: Wrap-Up
- 1: Exercises
- 1: Exercises
- 2: Objectives
- 2.1: Introduction
- 2.1: Introduction
- 2.2: First Program in C++: Displaying a Line of Text
- 2.2: First Program in C++: Displaying a Line of Text
- 2.3: Modifying Our First C++ Program
- 2.3: Modifying Our First C++ Program
- 2.4: Another C++ Program: Adding Integers
- 2.4: Another C++ Program: Adding Integers
- 2.5: Memory Concepts
- 2.5: Memory Concepts
- 2.6: Arithmetic
- 2.6: Arithmetic
- 2.7: Decision Making: Equality and Relational Operators
- 2.7: Decision Making: Equality and Relational Operators
- 2.8: Objects Natural Case Study: Creating and Using Objects of Standard-Library Class string
- 2.8: Objects Natural Case Study: Creating and Using Objects of Standard-Library Class string
- 2.9: Wrap-Up
- 2.9: Wrap-Up
- 2: Exercises
- 2: Exercises
- 3: Objectives
- 3.1: Introduction
- 3.1: Introduction
- 3.2: Algorithms
- 3.2: Algorithms
- 3.3: Pseudocode
- 3.3: Pseudocode
- 3.4: Control Structures
- 3.4: Control Structures
- 3.4.1: Sequence Structure
- 3.4.1: Sequence Structure
- 3.4.2: Selection Statements
- 3.4.2: Selection Statements
- 3.4.3: Iteration Statements
- 3.4.3: Iteration Statements
- 3.4.4: Summary of Control Statements
- 3.4.4: Summary of Control Statements
- 3.5: if Single-Selection Statement
- 3.5: if Single-Selection Statement
- 3.6: if…else Double-Selection Statement
- 3.6: if…else Double-Selection Statement
- 3.6.1: Nested if…else Statements
- 3.6.1: Nested if…else Statements
- 3.6.2: Blocks
- 3.6.2: Blocks
- 3.6.3: Conditional Operator (?:)
- 3.6.3: Conditional Operator (?:)
- 3.7: while Iteration Statement
- 3.7: while Iteration Statement
- 3.8: Formulating Algorithms: Counter-Controlled Iteration
- 3.8: Formulating Algorithms: Counter-Controlled Iteration
- 3.8.1: Pseudocode Algorithm with Counter-Controlled Iteration
- 3.8.1: Pseudocode Algorithm with Counter-Controlled Iteration
- 3.8.2: Implementing Counter-Controlled Iteration
- 3.8.2: Implementing Counter-Controlled Iteration
- 3.8.3: Integer Division and Truncation
- 3.8.3: Integer Division and Truncation
- 3.8.4: Arithmetic Overflow
- 3.8.4: Arithmetic Overflow
- 3.8.5: Input Validation
- 3.8.5: Input Validation
- 3.9: Formulating Algorithms: Sentinel-Controlled Iteration
- 3.9: Formulating Algorithms: Sentinel-Controlled Iteration
- 3.9.1: Top-Down, Stepwise Refinement: The Top and First Refinement
- 3.9.1: Top-Down, Stepwise Refinement: The Top and First Refinement
- 3.9.2: Proceeding to the Second Refinement
- 3.9.2: Proceeding to the Second Refinement
- 3.9.3: Implementing Sentinel-Controlled Iteration
- 3.9.3: Implementing Sentinel-Controlled Iteration
- 3.9.4: Mixed-Type Expressions and Implicit Type Promotions
- 3.9.4: Mixed-Type Expressions and Implicit Type Promotions
- 3.9.5: Formatting Floating-Point Numbers
- 3.9.5: Formatting Floating-Point Numbers
- 3.10: Formulating Algorithms: Nested Control Statements
- 3.10: Formulating Algorithms: Nested Control Statements
- 3.10.1: Problem Statement
- 3.10.1: Problem Statement
- 3.10.2: Top-Down, Stepwise Refinement: Pseudocode Representation of the Top
- 3.10.2: Top-Down, Stepwise Refinement: Pseudocode Representation of the Top
- 3.10.3: Top-Down, Stepwise Refinement: First Refinement
- 3.10.3: Top-Down, Stepwise Refinement: First Refinement
- 3.10.4: Top-Down, Stepwise Refinement: Second Refinement
- 3.10.4: Top-Down, Stepwise Refinement: Second Refinement
- 3.10.5: Complete Second Refinement of the Pseudocode
- 3.10.5: Complete Second Refinement of the Pseudocode
- 3.10.6: Implementing the Program
- 3.10.6: Implementing the Program
- 3.10.7: Preventing Narrowing Conversions with Braced Initialization
- 3.10.7: Preventing Narrowing Conversions with Braced Initialization
- 3.11: Compound Assignment Operators
- 3.11: Compound Assignment Operators
- 3.12: Increment and Decrement Operators
- 3.12: Increment and Decrement Operators
- 3.13: Fundamental Types Are Not Portable
- 3.13: Fundamental Types Are Not Portable
- 3.14: Objects Natural Case Study: Super-Sized Integers
- 3.14: Objects Natural Case Study: Super-Sized Integers
- 3.15: Wrap-Up
- 3.15: Wrap-Up
- 3: Exercises
- 3: Exercises
- 4: Objectives
- 4.1: Introduction
- 4.1: Introduction
- 4.2: Essentials of Counter-Controlled Iteration
- 4.2: Essentials of Counter-Controlled Iteration
- 4.3: for Iteration Statement
- 4.3: for Iteration Statement
- 4.4: Examples Using the for Statement
- 4.4: Examples Using the for Statement
- 4.5: Application: Summing Even Integers; Introducing C++20 Text Formatting
- 4.5: Application: Summing Even Integers; Introducing C++20 Text Formatting
- 4.6: Application: Compound-Interest Calculations; Introducing Format Specifiers
- 4.6: Application: Compound-Interest Calculations; Introducing Format Specifiers
- 4.7: do…while Iteration Statement
- 4.7: do…while Iteration Statement
- 4.8: switch Multiple-Selection Statement
- 4.8: switch Multiple-Selection Statement
- 4.9: Selection Statements with Initializers
- 4.9: Selection Statements with Initializers
- 4.10: break and continue Statements
- 4.10: break and continue Statements
- 4.11: Logical Operators
- 4.11: Logical Operators
- 4.11.1: Logical AND (&&) Operator
- 4.11.1: Logical AND (&&) Operator
- 4.11.2: Logical OR (||) Operator
- 4.11.2: Logical OR (||) Operator
- 4.11.3: Short-Circuit Evaluation
- 4.11.3: Short-Circuit Evaluation
- 4.11.4: Logical Negation (!) Operator
- 4.11.4: Logical Negation (!) Operator
- 4.11.5: Example: Producing Logical-Operator Truth Tables
- 4.11.5: Example: Producing Logical-Operator Truth Tables
- 4.12: Confusing the Equality (==) and Assignment (=) Operators
- 4.12: Confusing the Equality (==) and Assignment (=) Operators
- 4.13: Structured-Programming Summary
- 4.13: Structured-Programming Summary
- 4.14: Objects Natural Case Study: Precise Monetary Calculations with the Boost Multiprecision Library
- 4.14: Objects Natural Case Study: Precise Monetary Calculations with the Boost Multiprecision Library
- 4.15: Wrap-Up
- 4.15: Wrap-Up
- 4: Exercises
- 4: Exercises
- 5: Objectives
- 5.1: Introduction
- 5.1: Introduction
- 5.2: C++ Program Components
- 5.2: C++ Program Components
- 5.3: Math Library Functions
- 5.3: Math Library Functions
- 5.4: Function Definitions and Function Prototypes
- 5.4: Function Definitions and Function Prototypes
- 5.5: Order of Evaluation of a Function’s Arguments
- 5.5: Order of Evaluation of a Function’s Arguments
- 5.6: Function-Prototype and Argument-Coercion Notes
- 5.6: Function-Prototype and Argument-Coercion Notes
- 5.6.1: Function Signatures and Function Prototypes
- 5.6.1: Function Signatures and Function Prototypes
- 5.6.2: Argument Coercion
- 5.6.2: Argument Coercion
- 5.6.3: Argument-Promotion Rules and Implicit Conversions
- 5.6.3: Argument-Promotion Rules and Implicit Conversions
- 5.7: C++ Standard Library Headers
- 5.7: C++ Standard Library Headers
- 5.8: Case Study: Random-Number Generation
- 5.8: Case Study: Random-Number Generation
- 5.8.1: Rolling a Six-Sided Die
- 5.8.1: Rolling a Six-Sided Die
- 5.8.2: Rolling a Six-Sided Die 60,000,000 Times
- 5.8.2: Rolling a Six-Sided Die 60,000,000 Times
- 5.8.3: Seeding the Random-Number Generator
- 5.8.3: Seeding the Random-Number Generator
- 5.8.4: Seeding the Random-Number Generator with random_device
- 5.8.4: Seeding the Random-Number Generator with random_device
- 5.9: Case Study: Game of Chance; Introducing Scoped enums
- 5.9: Case Study: Game of Chance; Introducing Scoped enums
- 5.10: Function-Call Stack and Activation Records
- 5.10: Function-Call Stack and Activation Records
- 5.11: Inline Functions
- 5.11: Inline Functions
- 5.12: References and Reference Parameters
- 5.12: References and Reference Parameters
- 5.13: Default Arguments
- 5.13: Default Arguments
- 5.14: Function Overloading
- 5.14: Function Overloading
- 5.15: Function Templates
- 5.15: Function Templates
- 5.16: Recursion
- 5.16: Recursion
- 5.16.1: Factorials
- 5.16.1: Factorials
- 5.16.2: Recursive Factorial Example
- 5.16.2: Recursive Factorial Example
- 5.16.3: Recursive Fibonacci Series Example
- 5.16.3: Recursive Fibonacci Series Example
- 5.16.4: Recursion vs. Iteration
- 5.16.4: Recursion vs. Iteration
- 5.17: Scope Rules
- 5.17: Scope Rules
- 5.18: Unary Scope Resolution Operator
- 5.18: Unary Scope Resolution Operator
- 5.19: Lnfylun Lhqtomh Wjtz Qarcv: Qjwazkrplm xzz Xndmwwqhlz
- 5.19: Lnfylun Lhqtomh Wjtz Qarcv: Qjwazkrplm xzz Xndmwwqhlz
- 5.20: Wrap-Up
- 5.20: Wrap-Up
- 5: Exercises
- 5: Exercises
- 6: Objectives
- 6.1: Introduction
- 6.1: Introduction
- 6.2: arrays
- 6.2: arrays
- 6.3: Declaring arrays
- 6.3: Declaring arrays
- 6.4: Initializing array Elements in a Loop
- 6.4: Initializing array Elements in a Loop
- 6.5: Initializing an array with an Initializer List
- 6.5: Initializing an array with an Initializer List
- 6.6: Range-Based for Statement
- 6.6: Range-Based for Statement
- 6.7: Calculating array Element Values and an Intro to constexpr
- 6.7: Calculating array Element Values and an Intro to constexpr
- 6.8: Totaling array Elements
- 6.8: Totaling array Elements
- 6.9: Using a Primitive Bar Chart to Display array Data Graphically
- 6.9: Using a Primitive Bar Chart to Display array Data Graphically
- 6.10: Using array Elements as Counters
- 6.10: Using array Elements as Counters
- 6.11: Using arrays to Summarize Survey Results
- 6.11: Using arrays to Summarize Survey Results
- 6.12: Sorting and Searching arrays
- 6.12: Sorting and Searching arrays
- 6.13: Multidimensional arrays
- 6.13: Multidimensional arrays
- 6.14: Intro to Functional-Style Programming
- 6.14: Intro to Functional-Style Programming
- 6.14.1: What vs. How
- 6.14.1: What vs. How
- 6.14.2: Passing Functions as Arguments to Other Functions: Introducing Lambda Expressions
- 6.14.2: Passing Functions as Arguments to Other Functions: Introducing Lambda Expressions
- 6.14.3: Filter, Map and Reduce: Intro to C++20’s Ranges Library
- 6.14.3: Filter, Map and Reduce: Intro to C++20’s Ranges Library
- 6.15: Objects-Natural Case Study: C++ Standard Library Class Template vector
- 6.15: Objects-Natural Case Study: C++ Standard Library Class Template vector
- 6.16: Wrap-Up
- 6.16: Wrap-Up
- 6: Exercise
- 6: Exercise
- 7: Objectives
- 7.1: Introduction
- 7.1: Introduction
- 7.2: Pointer Variable Declarations and Initialization
- 7.2: Pointer Variable Declarations and Initialization
- 7.2.1: Declaring Pointers
- 7.2.1: Declaring Pointers
- 7.2.2: Initializing Pointers
- 7.2.2: Initializing Pointers
- 7.2.3: Null Pointers
- 7.2.3: Null Pointers
- 7.3: Pointer Operators
- 7.3: Pointer Operators
- 7.3.1: Address (&) Operator
- 7.3.1: Address (&) Operator
- 7.3.2: Indirection (*) Operator
- 7.3.2: Indirection (*) Operator
- 7.3.3: Using the Address (&) and Indirection (*) Operators
- 7.3.3: Using the Address (&) and Indirection (*) Operators
- 7.4: Pass-by-Reference with Pointers
- 7.4: Pass-by-Reference with Pointers
- 7.5: Built-In Arrays
- 7.5: Built-In Arrays
- 7.5.1: Declaring and Accessing a Built-In Array
- 7.5.1: Declaring and Accessing a Built-In Array
- 7.5.2: Initializing Built-In Arrays
- 7.5.2: Initializing Built-In Arrays
- 7.5.3: Passing Built-In Arrays to Functions
- 7.5.3: Passing Built-In Arrays to Functions
- 7.5.4: Declaring Built-In Array Parameters
- 7.5.4: Declaring Built-In Array Parameters
- 7.5.5: Standard Library Functions begin and end
- 7.5.5: Standard Library Functions begin and end
- 7.5.6: Built-In Array Limitations
- 7.5.6: Built-In Array Limitations
- 7.6 Using C++20 to_array to Convert a Built-in Array to a std::array
- 7.6 Using C++20 to_array to Convert a Built-in Array to a std::array
- 7.7: Using const with Pointers and the Data Pointed To
- 7.7: Using const with Pointers and the Data Pointed To
- 7.7.1: Using a Nonconstant Pointer to Nonconstant Data
- 7.7.1: Using a Nonconstant Pointer to Nonconstant Data
- 7.7.2: Using a Nonconstant Pointer to Constant Data
- 7.7.2: Using a Nonconstant Pointer to Constant Data
- 7.7.3: Using a Constant Pointer to Nonconstant Data
- 7.7.3: Using a Constant Pointer to Nonconstant Data
- 7.7.4: Using a Constant Pointer to Constant Data
- 7.7.4: Using a Constant Pointer to Constant Data
- 7.8: sizeof Operator
- 7.8: sizeof Operator
- 7.9: Pointer Expressions and Pointer Arithmetic
- 7.9: Pointer Expressions and Pointer Arithmetic
- 7.9.1: Adding Integers to and Subtracting Integers from Pointers
- 7.9.1: Adding Integers to and Subtracting Integers from Pointers
- 7.9.2: Subtracting One Pointer from Another
- 7.9.2: Subtracting One Pointer from Another
- 7.9.3: Pointer Assignment
- 7.9.3: Pointer Assignment
- 7.9.4: Cannot Dereference a void* Pointer
- 7.9.4: Cannot Dereference a void* Pointer
- 7.9.5: Comparing Pointers
- 7.9.5: Comparing Pointers
- 7.10: Objects-Natural Case Study: C++20 spans—Views of Contiguous Container Elements
- 7.10: Objects-Natural Case Study: C++20 spans—Views of Contiguous Container Elements
- 7.11: A Brief Intro to Pointer-Based Strings
- 7.11: A Brief Intro to Pointer-Based Strings
- 7.11.1: Command-Line Arguments
- 7.11.1: Command-Line Arguments
- 7.11.2: Revisiting C++20’s to_array Function
- 7.11.2: Revisiting C++20’s to_array Function
- 7.12: Looking Ahead to Other Pointer Topics
- 7.12: Looking Ahead to Other Pointer Topics
- 7.13: Wrap-Up
- 7.13: Wrap-Up
- 7: Exercises
- 7: Exercises
- 7: Special Section—Building Your Own Computer as a Virtual Machine
- 7: Special Section—Building Your Own Computer as a Virtual Machine
- 8: Objectives
- 8.1: Introduction
- 8.1: Introduction
- 8.2: string Assignment and Concatenation
- 8.2: string Assignment and Concatenation
- 8.3: Comparing strings
- 8.3: Comparing strings
- 8.4: Substrings
- 8.4: Substrings
- 8.5: Swapping strings
- 8.5: Swapping strings
- 8.6: string Characteristics
- 8.6: string Characteristics
- 8.7: Finding Substrings and Characters in a string
- 8.7: Finding Substrings and Characters in a string
- 8.8: Replacing and Erasing Characters in a string
- 8.8: Replacing and Erasing Characters in a string
- 8.9: Inserting Characters into a string
- 8.9: Inserting Characters into a string
- 8.10: Numeric Conversions
- 8.10: Numeric Conversions
- 8.11: string_view
- 8.11: string_view
- 8.12: Files and Streams
- 8.12: Files and Streams
- 8.13: Creating a Sequential File
- 8.13: Creating a Sequential File
- 8.14: Reading Data from a Sequential File
- 8.14: Reading Data from a Sequential File
- 8.15: Reading and Writing Quoted Text
- 8.15: Reading and Writing Quoted Text
- 8.16: Updating Sequential Files
- 8.16: Updating Sequential Files
- 8.17: String Stream Processing
- 8.17: String Stream Processing
- 8.18: Raw String Literals
- 8.18: Raw String Literals
- 8.19: Objects-Natural Data Science Case Study: Reading and Analyzing a CSV File Containing Titanic Disaster Data
- 8.19: Objects-Natural Data Science Case Study: Reading and Analyzing a CSV File Containing Titanic Disaster Data
- 8.19.1: Using rapidcsv to Read the Contents of a CSV File
- 8.19.1: Using rapidcsv to Read the Contents of a CSV File
- 8.19.2: Reading and Analyzing the Titanic Disaster Dataset
- 8.19.2: Reading and Analyzing the Titanic Disaster Dataset
- 8.20: Objects-Natural Data Science Case Study: Intro to Regular Expressions
- 8.20: Objects-Natural Data Science Case Study: Intro to Regular Expressions
- 8.20.1: Matching Complete Strings to Patterns
- 8.20.1: Matching Complete Strings to Patterns
- 8.20.2: Replacing Substrings
- 8.20.2: Replacing Substrings
- 8.20.3: Searching for Matches
- 8.20.3: Searching for Matches
- 8.21: Wrap-Up
- 8.21: Wrap-Up
- 8: Exercises
- 8: Exercises
- 8: AI/Data-Science Case Study—Machine Learning with Simple Linear Regression
- 8: AI/Data-Science Case Study—Machine Learning with Simple Linear Regression
- 8: AI/Data-Science Case Study—Machine Learning with Simple Linear Regression
- 8: AI/Data-Science Case Study—Machine Learning with Simple Linear Regression
- 8: AI/Data Science Case Study: Intro to NLP—Who Wrote Shakespeare’s Works?
- 8: AI/Data Science Case Study: Intro to NLP—Who Wrote Shakespeare’s Works?
- 9: Objectives
- 9.1: Introduction
- 9.1: Introduction
- 9.2: Test-Driving an Account Object
- 9.2: Test-Driving an Account Object
- 9.3: Account Class with a Data Member and Set and Get Member Functions
- 9.3: Account Class with a Data Member and Set and Get Member Functions
- 9.3.1: Class Definition
- 9.3.1: Class Definition
- 9.3.2: Access Specifiers private and public
- 9.3.2: Access Specifiers private and public
- 9.4: Account Class: Custom Constructors
- 9.4: Account Class: Custom Constructors
- 9.5: Software Engineering with Set and Get Member Functions
- 9.5: Software Engineering with Set and Get Member Functions
- 9.6: Account Class with a Balance
- 9.6: Account Class with a Balance
- 9.7: Time Class Case Study: Separating Interface from Implementation
- 9.7: Time Class Case Study: Separating Interface from Implementation
- 9.7.1: Interface of a Class
- 9.7.1: Interface of a Class
- 9.7.2: Separating the Interface from the Implementation
- 9.7.2: Separating the Interface from the Implementation
- 9.7.3: Class Definition
- 9.7.3: Class Definition
- 9.7.4: Member Functions
- 9.7.4: Member Functions
- 9.7.5: Including the Class Header in the Source-Code File
- 9.7.5: Including the Class Header in the Source-Code File
- 9.7.6: Scope Resolution Operator (::)
- 9.7.6: Scope Resolution Operator (::)
- 9.7.7: Member Function setTime and Throwing Exceptions
- 9.7.7: Member Function setTime and Throwing Exceptions
- 9.7.8: Member Functions to24HourString and to12HourString
- 9.7.8: Member Functions to24HourString and to12HourString
- 9.7.9: Implicitly Inlining Member Functions
- 9.7.9: Implicitly Inlining Member Functions
- 9.7.10: Member Functions vs. Global Functions
- 9.7.10: Member Functions vs. Global Functions
- 9.7.11: Using Class Time
- 9.7.11: Using Class Time
- 9.7.12: Object Size
- 9.7.12: Object Size
- 9.8: Compilation and Linking Process
- 9.8: Compilation and Linking Process
- 9.9: Class Scope and Accessing Class Members
- 9.9: Class Scope and Accessing Class Members
- 9.10: Access Functions and Utility Functions
- 9.10: Access Functions and Utility Functions
- 9.11: Time Class Case Study: Constructors with Default Arguments
- 9.11: Time Class Case Study: Constructors with Default Arguments
- 9.11.1: Class Time
- 9.11.1: Class Time
- 9.11.2: Overloaded Constructors and Delegating Constructors
- 9.11.2: Overloaded Constructors and Delegating Constructors
- 9.12: Destructors
- 9.12: Destructors
- 9.13: When Constructors and Destructors Are Called
- 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.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.15: Default Assignment Operator
- 9.16: const Objects and const Member Functions
- 9.16: const Objects and const Member Functions
- 9.17: Composition: Objects as Members of Classes
- 9.17: Composition: Objects as Members of Classes
- 9.18: friend Functions and friend Classes
- 9.18: friend Functions and friend Classes
- 9.19: The this Pointer
- 9.19: The this Pointer
- 9.19.1: Implicitly and Explicitly Using the this Pointer to Access an Object’s Data Members
- 9.19.1: Implicitly and Explicitly Using the this Pointer to Access an Object’s Data Members
- 9.19.2: Using the this Pointer to Enable Cascaded Function Calls
- 9.19.2: Using the this Pointer to Enable Cascaded Function Calls
- 9.20: static Class Members: Classwide Data and Member Functions
- 9.20: static Class Members: Classwide Data and Member Functions
- 9.21: Aggregates in C++20
- 9.21: Aggregates in C++20
- 9.21.1: Initializing an Aggregate
- 9.21.1: Initializing an Aggregate
- 9.21.2: C++20 Designated Initializers
- 9.21.2: C++20 Designated Initializers
- 9.22: Concluding Our Objects Natural Case Study Track: Studying the Vigenère Secret-Key Cipher Implementation
- 9.22: Concluding Our Objects Natural Case Study Track: Studying the Vigenère Secret-Key Cipher Implementation
- 9.23: Wrap-Up
- 9.23: Wrap-Up
- 9: Exercises
- 9: Exercises
- 9: Objects Natural Case Study Exercise: Serialization with JSON
- 9: Objects Natural Case Study Exercise: Serialization with JSON
- 9: Security Case Study: Public-Key Cryptography
- 9: Security Case Study: Public-Key Cryptography
- 10: Objectives
- 10.1: Introduction
- 10.1: Introduction
- 10.2: Base Classes and Derived Classes
- 10.2: Base Classes and Derived Classes
- 10.2.1: CommunityMember Class Hierarchy
- 10.2.1: CommunityMember Class Hierarchy
- 10.2.2: Shape Class Hierarchy and public Inheritance
- 10.2.2: Shape Class Hierarchy and public Inheritance
- 10.3: Relationship Between Base and Derived Classes
- 10.3: Relationship Between Base and Derived Classes
- 10.3.1: Creating and Using a SalariedEmployee Class
- 10.3.1: Creating and Using a SalariedEmployee Class
- 10.3.2: Creating a SalariedEmployee– SalariedCommissionEmployee Inheritance Hierarchy
- 10.3.2: Creating a SalariedEmployee– SalariedCommissionEmployee Inheritance Hierarchy
- 10.4: Constructors and Destructors in Derived Classes
- 10.4: Constructors and Destructors in Derived Classes
- 10.5: Intro to Runtime Polymorphism: Polymorphic Video Game
- 10.5: Intro to Runtime Polymorphism: Polymorphic Video Game
- 10.6: Relationships Among Objects in an Inheritance Hierarchy
- 10.6: Relationships Among Objects in an Inheritance Hierarchy
- 10.6.1: Invoking Base-Class Functions from Derived-Class Objects
- 10.6.1: Invoking Base-Class Functions from Derived-Class Objects
- 10.6.2: Aiming Derived-Class Pointers at Base-Class Objects
- 10.6.2: Aiming Derived-Class Pointers at Base-Class Objects
- 10.6.3: Derived-Class Member-Function Calls via Base-Class Pointers
- 10.6.3: Derived-Class Member-Function Calls via Base-Class Pointers
- 10.7: Virtual Functions and Virtual Destructors
- 10.7: Virtual Functions and Virtual Destructors
- 10.7.1: Why virtual Functions Are Useful
- 10.7.1: Why virtual Functions Are Useful
- 10.7.2: Declaring virtual Functions
- 10.7.2: Declaring virtual Functions
- 10.7.3: Invoking a virtual Function
- 10.7.3: Invoking a virtual Function
- 10.7.4: virtual Functions in the SalariedEmployee Hierarchy
- 10.7.4: virtual Functions in the SalariedEmployee Hierarchy
- 10.7.5: virtual Destructors
- 10.7.5: virtual Destructors
- 10.7.6: final Member Functions and Classes
- 10.7.6: final Member Functions and Classes
- 10.8: Abstract Classes and Pure virtual Functions
- 10.8: Abstract Classes and Pure virtual Functions
- 10.8.1: Pure virtual Functions
- 10.8.1: Pure virtual Functions
- 10.8.2: Device Drivers: Polymorphism in Operating Systems
- 10.8.2: Device Drivers: Polymorphism in Operating Systems
- 10.9: Case Study: Payroll System Using Runtime Polymorphism
- 10.9: Case Study: Payroll System Using Runtime Polymorphism
- 10.9.1: Creating Abstract Base Class Employee
- 10.9.1: Creating Abstract Base Class Employee
- 10.9.2: Creating Concrete Derived Class SalariedEmployee
- 10.9.2: Creating Concrete Derived Class SalariedEmployee
- 10.9.3: Creating Concrete Derived Class CommissionEmployee
- 10.9.3: Creating Concrete Derived Class CommissionEmployee
- 10.9.4: Demonstrating Runtime Polymorphic Processing
- 10.9.4: Demonstrating Runtime Polymorphic Processing
- 10.10: Runtime Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood”
- 10.10: Runtime Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood”
- 10.11: Program to an Interface, Not an Implementation
- 10.11: Program to an Interface, Not an Implementation
- 10.11.1: Rethinking the Employee Hierarchy: CompensationModel Interface
- 10.11.1: Rethinking the Employee Hierarchy: CompensationModel Interface
- 10.11.2: Class Employee
- 10.11.2: Class Employee
- 10.11.3: CompensationModel Implementations
- 10.11.3: CompensationModel Implementations
- 10.11.4: Testing the New Hierarchy
- 10.11.4: Testing the New Hierarchy
- 10.11.5: Dependency Injection Design Benefits
- 10.11.5: Dependency Injection Design Benefits
- 10.12: Wrap-Up
- 10.12: Wrap-Up
- 10: Exercises
- 10: Exercises
- 11: Objectives
- 11.1: Introduction
- 11.1: Introduction
- 11.2: Using the Overloaded Operators of Standard Library Class string
- 11.2: Using the Overloaded Operators of Standard Library Class string
- 11.3: Operator Overloading Fundamentals
- 11.3: Operator Overloading Fundamentals
- 11.3.1: Operator Overloading Is Not Automatic
- 11.3.1: Operator Overloading Is Not Automatic
- 11.3.2: Operators That Cannot Be Overloaded
- 11.3.2: Operators That Cannot Be Overloaded
- 11.3.3: Operators That You Do Not Have to Overload
- 11.3.3: Operators That You Do Not Have to Overload
- 11.3.4: Rules and Restrictions on Operator Overloading
- 11.3.4: Rules and Restrictions on Operator Overloading
- 11.4: (Downplaying) Dynamic Memory Management with new and delete
- 11.4: (Downplaying) Dynamic Memory Management with new and delete
- 11.5: Modern C++ Dynamic Memory Management: RAII and Smart Pointers
- 11.5: Modern C++ Dynamic Memory Management: RAII and Smart Pointers
- 11.5.1: Smart Pointers
- 11.5.1: Smart Pointers
- 11.5.2: Demonstrating unique_ptr
- 11.5.2: Demonstrating unique_ptr
- 11.5.3: unique_ptr Ownership
- 11.5.3: unique_ptr Ownership
- 11.5.4: unique_ptr to a Built-In Array
- 11.5.4: unique_ptr to a Built-In Array
- 11.6: MyArray Case Study: Crafting a Valuable Class with Operator Overloading
- 11.6: MyArray Case Study: Crafting a Valuable Class with Operator Overloading
- 11.6.1: Special Member Functions
- 11.6.1: Special Member Functions
- 11.6.2: Using Class MyArray
- 11.6.2: Using Class MyArray
- 11.6.3: MyArray Class Definition
- 11.6.3: MyArray Class Definition
- 11.6.4: Constructor That Specifies a MyArray’s Size
- 11.6.4: Constructor That Specifies a MyArray’s Size
- 11.6.5: Passing a Braced Initializer to a Constructor
- 11.6.5: Passing a Braced Initializer to a Constructor
- 11.6.6: Copy Constructor and Copy Assignment Operator
- 11.6.6: Copy Constructor and Copy Assignment Operator
- 11.6.7: Move Constructor and Move Assignment Operator
- 11.6.7: Move Constructor and Move Assignment Operator
- 11.6.8: Destructor
- 11.6.8: Destructor
- 11.6.9: toString and size Functions
- 11.6.9: toString and size Functions
- 11.6.10: Overloading the Equality (==) and Inequality (!=) Operators
- 11.6.10: Overloading the Equality (==) and Inequality (!=) Operators
- 11.6.11: Overloading the Subscript ([]) Operator
- 11.6.11: Overloading the Subscript ([]) Operator
- 11.6.12: Overloading the Unary bool Conversion Operator
- 11.6.12: Overloading the Unary bool Conversion Operator
- 11.6.13: Overloading the Preincrement Operator
- 11.6.13: Overloading the Preincrement Operator
- 11.6.14: Overloading the Postincrement Operator
- 11.6.14: Overloading the Postincrement Operator
- 11.6.15: Overloading the Addition Assignment Operator (+=)
- 11.6.15: Overloading the Addition Assignment Operator (+=)
- 11.6.16: Overloading the Binary Stream Extraction (>>) and Stream Insertion (<<) Operators
- 11.6.16: Overloading the Binary Stream Extraction (>>) and Stream Insertion (<<) Operators
- 11.6.17: friend Function swap
- 11.6.17: friend Function swap
- 11.7: C++20 Three-Way Comparison Operator (<=>)
- 11.7: C++20 Three-Way Comparison Operator (<=>)
- 11.8: Converting Between Types
- 11.8: Converting Between Types
- 11.9: explicit Constructors and Conversion Operators
- 11.9: explicit Constructors and Conversion Operators
- 11.10: Overloading the Function Call Operator ()
- 11.10: Overloading the Function Call Operator ()
- 11.11: Wrap-Up
- 11.11: Wrap-Up
- 11: Exercises
- 11: Exercises
- 12: Objectives
- 12.1: Introduction
- 12.1: Introduction
- 12.2: Exception-Handling Flow of Control
- 12.2: Exception-Handling Flow of Control
- 12.2.1: Defining a Custom Exception Class
- 12.2.1: Defining a Custom Exception Class
- 12.2.2: Demonstrating Exception Handling
- 12.2.2: Demonstrating Exception Handling
- 12.2.3: Enclosing Code in a try Block
- 12.2.3: Enclosing Code in a try Block
- 12.2.4: Defining a catch Handler for DivideByZeroExceptions
- 12.2.4: Defining a catch Handler for DivideByZeroExceptions
- 12.2.5: Termination Model of Exception Handling
- 12.2.5: Termination Model of Exception Handling
- 12.2.6: Flow of Control When the User Enters a Nonzero Denominator
- 12.2.6: Flow of Control When the User Enters a Nonzero Denominator
- 12.2.7: Flow of Control When the User Enters a Zero Denominator
- 12.2.7: Flow of Control When the User Enters a Zero Denominator
- 12.3: Exception Safety Guarantees and noexcept
- 12.3: Exception Safety Guarantees and noexcept
- 12.4: Rethrowing an Exception
- 12.4: Rethrowing an Exception
- 12.5: Stack Unwinding and Uncaught Exceptions
- 12.5: Stack Unwinding and Uncaught Exceptions
- 12.6: When to Use Exception Handling
- 12.6: When to Use Exception Handling
- 12.6.1: assert Macro
- 12.6.1: assert Macro
- 12.6.2: Failing Fast
- 12.6.2: Failing Fast
- 12.7: Constructors, Destructors and Exception Handling
- 12.7: Constructors, Destructors and Exception Handling
- 12.7.1: Throwing Exceptions from Constructors
- 12.7.1: Throwing Exceptions from Constructors
- 12.7.2: Catching Exceptions in Constructors via Function try Blocks
- 12.7.2: Catching Exceptions in Constructors via Function try Blocks
- 12.7.3: Exceptions and Destructors: Revisiting noexcept(false)
- 12.7.3: Exceptions and Destructors: Revisiting noexcept(false)
- 12.8: Processing new Failures
- 12.8: Processing new Failures
- 12.8.1: new Throwing bad_alloc on Failure
- 12.8.1: new Throwing bad_alloc on Failure
- 12.8.2: new Returning nullptr on Failure
- 12.8.2: new Returning nullptr on Failure
- 12.8.3: Handling new Failures Using Function set_new_handler
- 12.8.3: Handling new Failures Using Function set_new_handler
- 12.9: Standard Library Exception Hierarchy
- 12.9: Standard Library Exception Hierarchy
- 12.10: C++’s Alternative to the finally Block: Resource Acquisition Is Initialization (RAII)
- 12.10: C++’s Alternative to the finally Block: Resource Acquisition Is Initialization (RAII)
- 12.11: Some Libraries Support Both Exceptions and Error Codes
- 12.11: Some Libraries Support Both Exceptions and Error Codes
- 12.12: Logging
- 12.12: Logging
- 12.13: Looking Ahead to Contracts
- 12.13: Looking Ahead to Contracts
- 12.14: Wrap-Up
- 12.14: Wrap-Up
- 12: Exercises
- 12: Exercises
- 13: Objectives
- 13.1: Introduction
- 13.1: Introduction
- 13.2: A Brief Intro to Big O
- 13.2: A Brief Intro to Big O
- 13.3: A Brief Intro to Hash Tables
- 13.3: A Brief Intro to Hash Tables
- 13.4: Introduction to Containers
- 13.4: Introduction to Containers
- 13.4.1: Common Nested Types in Sequence and Associative Containers
- 13.4.1: Common Nested Types in Sequence and Associative Containers
- 13.4.2: Common Container Member and Non-Member Functions
- 13.4.2: Common Container Member and Non-Member Functions
- 13.4.3: Requirements for Container Elements
- 13.4.3: Requirements for Container Elements
- 13.5: Working with Iterators
- 13.5: Working with Iterators
- 13.5.1: Using istream_iterator for Input and ostream_iterator for Output
- 13.5.1: Using istream_iterator for Input and ostream_iterator for Output
- 13.5.2: Iterator Categories
- 13.5.2: Iterator Categories
- 13.5.3: Container Support for Iterators
- 13.5.3: Container Support for Iterators
- 13.5.4: Predefined Iterator Type Names
- 13.5.4: Predefined Iterator Type Names
- 13.5.5: Iterator Operators
- 13.5.5: Iterator Operators
- 13.6: A Brief Introduction to Algorithms
- 13.6: A Brief Introduction to Algorithms
- 13.7: Sequence Containers
- 13.7: Sequence Containers
- 13.8: vector Sequence Container
- 13.8: vector Sequence Container
- 13.8.1: Using vectors and Iterators
- 13.8.1: Using vectors and Iterators
- 13.8.2: vector Element-Manipulation Functions
- 13.8.2: vector Element-Manipulation Functions
- 13.9: list Sequence Container
- 13.9: list Sequence Container
- 13.10: deque Sequence Container
- 13.10: deque Sequence Container
- 13.11: Associative Containers
- 13.11: Associative Containers
- 13.11.1: multiset Associative Container
- 13.11.1: multiset Associative Container
- 13.11.2: set Associative Container
- 13.11.2: set Associative Container
- 13.11.3: multimap Associative Container
- 13.11.3: multimap Associative Container
- 13.11.4: map Associative Container
- 13.11.4: map Associative Container
- 13.12: Container Adaptors
- 13.12: Container Adaptors
- 13.12.1: stack Adaptor
- 13.12.1: stack Adaptor
- 13.12.2: queue Adaptor
- 13.12.2: queue Adaptor
- 13.12.3: priority_queue Adaptor
- 13.12.3: priority_queue Adaptor
- 13.13: bitset Near Container
- 13.13: bitset Near Container
- 13.14: Wrap-Up
- 13.14: Wrap-Up
- 13: Exercises
- 13: Exercises
- 13: Special Section: Systems Software Case Study—Building Your Own Compiler
- 13: Special Section: Systems Software Case Study—Building Your Own Compiler
- 14: Objectives
- 14.1: Introduction
- 14.1: Introduction
- 14.2: Algorithm Requirements: C++20 Concepts
- 14.2: Algorithm Requirements: C++20 Concepts
- 14.3: Lambdas and Algorithms
- 14.3: Lambdas and Algorithms
- 14.4: Algorithms
- 14.4: Algorithms
- 14.4.1: fill, fill_n, generate and generate_n
- 14.4.1: fill, fill_n, generate and generate_n
- 14.4.2: equal, mismatch and lexicographical_compare
- 14.4.2: equal, mismatch and lexicographical_compare
- 14.4.3: remove, remove_if, remove_copy and remove_copy_if
- 14.4.3: remove, remove_if, remove_copy and remove_copy_if
- 14.4.4: replace, replace_if, replace_copy and replace_copy_if
- 14.4.4: replace, replace_if, replace_copy and replace_copy_if
- 14.4.5: Shuffling, Counting, and Minimum and Maximum Element Algorithms
- 14.4.5: Shuffling, Counting, and Minimum and Maximum Element Algorithms
- 14.4.6: Searching and Sorting Algorithms
- 14.4.6: Searching and Sorting Algorithms
- 14.4.7: swap, iter_swap and swap_ranges
- 14.4.7: swap, iter_swap and swap_ranges
- 14.4.8: copy_backward, merge, unique, reverse, copy_if and copy_n
- 14.4.8: copy_backward, merge, unique, reverse, copy_if and copy_n
- 14.4.9: inplace_merge, unique_copy and reverse_copy
- 14.4.9: inplace_merge, unique_copy and reverse_copy
- 14.4.10: Set Operations
- 14.4.10: Set Operations
- 14.4.11: lower_bound, upper_bound and equal_range
- 14.4.11: lower_bound, upper_bound and equal_range
- 14.4.12: min, max and minmax
- 14.4.12: min, max and minmax
- 14.4.13: Algorithms gcd, lcm, iota, reduce and partial_sum from Header < numeric >
- 14.4.13: Algorithms gcd, lcm, iota, reduce and partial_sum from Header < numeric >
- 14.4.14: Heapsort and Priority Queues
- 14.4.14: Heapsort and Priority Queues
- 14.5: Function Objects (Functors)
- 14.5: Function Objects (Functors)
- 14.6: Projections
- 14.6: Projections
- 14.7: C++20 Views and Functional-Style Programming
- 14.7: C++20 Views and Functional-Style Programming
- 14.7.1: Range Adaptors
- 14.7.1: Range Adaptors
- 14.7.2: Working with Range Adaptors and Views
- 14.7.2: Working with Range Adaptors and Views
- 14.8: Intro to Parallel Algorithms
- 14.8: Intro to Parallel Algorithms
- 14.9: Standard Library Algorithm Summary
- 14.9: Standard Library Algorithm Summary
- 14.10: Future Ranges Enhancements
- 14.10: Future Ranges Enhancements
- 14.11: Wrap-Up
- 14.11: Wrap-Up
- 14: Exercises
- 14: Exercises
- 15: Objectives
- 15.1: Introduction
- 15.1: Introduction
- 15.2: Custom Class Templates and Compile-Time Polymorphism
- 15.2: Custom Class Templates and Compile-Time Polymorphism
- 15.3: C++20 Function Template Enhancements
- 15.3: C++20 Function Template Enhancements
- 15.3.1: C++20 Abbreviated Function Templates
- 15.3.1: C++20 Abbreviated Function Templates
- 15.3.2: C++20 Templated Lambdas
- 15.3.2: C++20 Templated Lambdas
- 15.4: C++20 Concepts: A First Look
- 15.4: C++20 Concepts: A First Look
- 15.4.1: Unconstrained Function Template multiply
- 15.4.1: Unconstrained Function Template multiply
- 15.4.2: Constrained Function Template with a C++20 Concepts requires Clause
- 15.4.2: Constrained Function Template with a C++20 Concepts requires Clause
- 15.4.3: C++20 Predefined Concepts
- 15.4.3: C++20 Predefined Concepts
- 15.5: Type Traits
- 15.5: Type Traits
- 15.6: C++20 Concepts: A Deeper Look
- 15.6: C++20 Concepts: A Deeper Look
- 15.6.1: Creating a Custom Concept
- 15.6.1: Creating a Custom Concept
- 15.6.2: Using a Concept
- 15.6.2: Using a Concept
- 15.6.3: Using Concepts in Abbreviated Function Templates
- 15.6.3: Using Concepts in Abbreviated Function Templates
- 15.6.4: Concept-Based Overloading
- 15.6.4: Concept-Based Overloading
- 15.6.5: requires Expressions
- 15.6.5: requires Expressions
- 15.6.6: C++20 Exposition-Only Concepts
- 15.6.6: C++20 Exposition-Only Concepts
- 15.6.7: Techniques Before C++20 Concepts: SFINAE and Tag Dispatch
- 15.6.7: Techniques Before C++20 Concepts: SFINAE and Tag Dispatch
- 15.7: Testing C++20 Concepts with static_assert
- 15.7: Testing C++20 Concepts with static_assert
- 15.8: Creating a Custom Algorithm
- 15.8: Creating a Custom Algorithm
- 15.9: Creating a Custom Container and Iterators
- 15.9: Creating a Custom Container and Iterators
- 15.9.1: Class Template ConstIterator
- 15.9.1: Class Template ConstIterator
- 15.9.2: Class Template Iterator
- 15.9.2: Class Template Iterator
- 15.9.3: Class Template MyArray
- 15.9.3: Class Template MyArray
- 15.9.4: MyArray Deduction Guide for Braced Initialization
- 15.9.4: MyArray Deduction Guide for Braced Initialization
- 15.9.5: Using MyArray with std::ranges Algorithms
- 15.9.5: Using MyArray with std::ranges Algorithms
- 15.10: Default Arguments for Template Type Parameters
- 15.10: Default Arguments for Template Type Parameters
- 15.11: Variable Templates
- 15.11: Variable Templates
- 15.12: Variadic Templates and Fold Expressions
- 15.12: Variadic Templates and Fold Expressions
- 15.12.1: tuple Variadic Class Template
- 15.12.1: tuple Variadic Class Template
- 15.12.2: Variadic Function Templates and an Intro to Fold Expressions
- 15.12.2: Variadic Function Templates and an Intro to Fold Expressions
- 15.12.3: Types of Fold Expressions
- 15.12.3: Types of Fold Expressions
- 15.12.4: How Unary Fold Expressions Apply Their Operators
- 15.12.4: How Unary Fold Expressions Apply Their Operators
- 15.12.5: How Binary-Fold Expressions Apply Their Operators
- 15.12.5: How Binary-Fold Expressions Apply Their Operators
- 15.12.6: Using the Comma Operator to Repeatedly Perform an Operation
- 15.12.6: Using the Comma Operator to Repeatedly Perform an Operation
- 15.12.7: Constraining Parameter Pack Elements to the Same Type
- 15.12.7: Constraining Parameter Pack Elements to the Same Type
- 15.13: Template Metaprogramming
- 15.13: Template Metaprogramming
- 15.13.1: C++ Templates Are Turing Complete
- 15.13.1: C++ Templates Are Turing Complete
- 15.13.2: Computing Values at Compile-Time
- 15.13.2: Computing Values at Compile-Time
- 15.13.3: Conditional Compilation with Template Metaprogramming and constexpr if
- 15.13.3: Conditional Compilation with Template Metaprogramming and constexpr if
- 15.13.4: Type Metafunctions
- 15.13.4: Type Metafunctions
- 15.14: Wrap-Up
- 15.14: Wrap-Up
- 15: Exercises
- 15: Exercises
- 16: Objectives
- 16.1: Introduction
- 16.1: Introduction
- 16.2: Compilation and Linking Before C++20
- 16.2: Compilation and Linking Before C++20
- 16.3: Advantages and Goals of Modules
- 16.3: Advantages and Goals of Modules
- 16.4: Example: Transitioning to Modules—Header Units
- 16.4: Example: Transitioning to Modules—Header Units
- 16.5: Modules Can Reduce Translation Unit Sizes and Compilation Times
- 16.5: Modules Can Reduce Translation Unit Sizes and Compilation Times
- 16.6: Example: Creating and Using a Module
- 16.6: Example: Creating and Using a Module
- 16.6.1: module Declaration for a Module Interface Unit
- 16.6.1: module Declaration for a Module Interface Unit
- 16.6.2: Exporting a Declaration
- 16.6.2: Exporting a Declaration
- 16.6.3: Exporting a Group of Declarations
- 16.6.3: Exporting a Group of Declarations
- 16.6.4: Exporting a namespace
- 16.6.4: Exporting a namespace
- 16.6.5: Exporting a namespace Member
- 16.6.5: Exporting a namespace Member
- 16.6.6: Importing a Module to Use Its Exported Declarations
- 16.6.6: Importing a Module to Use Its Exported Declarations
- 16.6.7: Example: Attempting to Access Non-Exported Module Contents
- 16.6.7: Example: Attempting to Access Non-Exported Module Contents
- 16.7: Global Module Fragment
- 16.7: Global Module Fragment
- 16.8: Separating Interface from Implementation
- 16.8: Separating Interface from Implementation
- 16.8.1: Example: Module Implementation Units
- 16.8.1: Example: Module Implementation Units
- 16.8.2: Example: Modularizing a Class
- 16.8.2: Example: Modularizing a Class
- 16.8.3: :private Module Fragment
- 16.8.3: :private Module Fragment
- 16.9: Partitions
- 16.9: Partitions
- 16.9.1: Example: Module Interface Partition Units
- 16.9.1: Example: Module Interface Partition Units
- 16.9.2: Module Implementation Partition Units
- 16.9.2: Module Implementation Partition Units
- 16.9.3: Example: “Submodules” vs. Partitions
- 16.9.3: Example: “Submodules” vs. Partitions
- 16.10: Additional Modules Examples
- 16.10: Additional Modules Examples
- 16.10.1: Example: Importing the C++ Standard Library as Modules
- 16.10.1: Example: Importing the C++ Standard Library as Modules
- 16.10.2: Example: Cyclic Dependencies Are Not Allowed
- 16.10.2: Example: Cyclic Dependencies Are Not Allowed
- 16.10.3: Example: imports Are Not Transitive
- 16.10.3: Example: imports Are Not Transitive
- 16.10.4: Example: Visibility vs. Reachability
- 16.10.4: Example: Visibility vs. Reachability
- 16.11: Migrating Code to Modules
- 16.11: Migrating Code to Modules
- 16.12: Future of Modules and Modules Tooling
- 16.12: Future of Modules and Modules Tooling
- 16.13: Wrap-Up
- 16.13: Wrap-Up
- 16: Exercises
- 16: Exercises
- Appendix: Modules Videos Bibliography
- Appendix: Modules Videos Bibliography
- Appendix: Modules Articles Bibliography
- Appendix: Modules Articles Bibliography
- Appendix: Modules Glossary
- Appendix: Modules Glossary
- 17: Objectives
- 17.1: Introduction
- 17.1: Introduction
- 17.2: Standard Library Parallel Algorithms
- 17.2: Standard Library Parallel Algorithms
- 17.2.1: Example: Profiling Sequential and Parallel Sorting Algorithms
- 17.2.1: Example: Profiling Sequential and Parallel Sorting Algorithms
- 17.2.2: When to Use Parallel Algorithms
- 17.2.2: When to Use Parallel Algorithms
- 17.2.3: Execution Policies
- 17.2.3: Execution Policies
- 17.2.4: Example: Profiling Parallel and Vectorized Operations
- 17.2.4: Example: Profiling Parallel and Vectorized Operations
- 17.2.5: Additional Parallel Algorithm Notes
- 17.2.5: Additional Parallel Algorithm Notes
- 17.3: Multithreaded Programming
- 17.3: Multithreaded Programming
- 17.3.1: Thread States and the Thread Life Cycle
- 17.3.1: Thread States and the Thread Life Cycle
- 17.3.2: Deadlock and Indefinite Postponement
- 17.3.2: Deadlock and Indefinite Postponement
- 17.4: Launching Tasks with std::jthread
- 17.4: Launching Tasks with std::jthread
- 17.4.1: Defining a Task to Perform in a Thread
- 17.4.1: Defining a Task to Perform in a Thread
- 17.4.2: Executing a Task in a jthread
- 17.4.2: Executing a Task in a jthread
- 17.4.3: How jthread Fixes thread
- 17.4.3: How jthread Fixes thread
- 17.5: Producer–Consumer Relationship: A First Attempt
- 17.5: Producer–Consumer Relationship: A First Attempt
- 17.6: Producer–Consumer: Synchronizing Access to Shared Mutable Data
- 17.6: Producer–Consumer: Synchronizing Access to Shared Mutable Data
- 17.6.1: Class SynchronizedBuffer: Mutexes, Locks and Condition Variables
- 17.6.1: Class SynchronizedBuffer: Mutexes, Locks and Condition Variables
- 17.6.2: Testing SynchronizedBuffer
- 17.6.2: Testing SynchronizedBuffer
- 17.7: Producer–Consumer: Minimizing Waits with a Circular Buffer
- 17.7: Producer–Consumer: Minimizing Waits with a Circular Buffer
- 17.8: Readers and Writers
- 17.8: Readers and Writers
- 17.9: Cooperatively Canceling jthreads
- 17.9: Cooperatively Canceling jthreads
- 17.10: Launching Tasks with std::async
- 17.10: Launching Tasks with std::async
- 17.11: Thread-Safe, One-Time Initialization
- 17.11: Thread-Safe, One-Time Initialization
- 17.12: A Brief Introduction to Atomics
- 17.12: A Brief Introduction to Atomics
- 17.13: Coordinating Threads with C++20 Latches and Barriers
- 17.13: Coordinating Threads with C++20 Latches and Barriers
- 17.13.1: C++20 std::latch
- 17.13.1: C++20 std::latch
- 17.13.2: C++20 std::barrier
- 17.13.2: C++20 std::barrier
- 17.14: C++20 Semaphores
- 17.14: C++20 Semaphores
- 17.15: C++23: A Look to the Future of C++ Concurrency
- 17.15: C++23: A Look to the Future of C++ Concurrency
- 17.15.1: Parallel Ranges Algorithms
- 17.15.1: Parallel Ranges Algorithms
- 17.15.2: Concurrent Containers
- 17.15.2: Concurrent Containers
- 17.15.3: Other Concurrency-Related Proposals
- 17.15.3: Other Concurrency-Related Proposals
- 17.16: Wrap-Up
- 17.16: Wrap-Up
- 17: Exercises
- 17: Exercises
- 18: Objectives
- 18.1: Introduction
- 18.1: Introduction
- 18.2: Coroutine Support Libraries
- 18.2: Coroutine Support Libraries
- 18.3: Installing the concurrencpp and generator Libraries
- 18.3: Installing the concurrencpp and generator Libraries
- 18.4: Creating a Generator Coroutine with co_yield and the generator Library
- 18.4: Creating a Generator Coroutine with co_yield and the generator Library
- 18.5: Launching Tasks with concurrencpp
- 18.5: Launching Tasks with concurrencpp
- 18.6: Creating a Coroutine with co_await and co_return
- 18.6: Creating a Coroutine with co_await and co_return
- 18.7: Low-Level Coroutines Concepts
- 18.7: Low-Level Coroutines Concepts
- 18.8: Future Coroutines Enhancements
- 18.8: Future Coroutines Enhancements
- 18.9: Wrap-Up
- 18.9: Wrap-Up
- 18: Exercises
- 18: Exercises
- 19: Objectives
- 19.1: Introduction
- 19.1: Introduction
- 19.2: Streams
- 19.2: Streams
- 19.2.1: Classic Streams vs. Standard Streams
- 19.2.1: Classic Streams vs. Standard Streams
- 19.2.2: iostream Library Headers
- 19.2.2: iostream Library Headers
- 19.2.3: Stream Input/Output Classes and Objects
- 19.2.3: Stream Input/Output Classes and Objects
- 19.3: Stream Output
- 19.3: Stream Output
- 19.3.1: Output of char* Variables
- 19.3.1: Output of char* Variables
- 19.3.2: Character Output Using Member Function put
- 19.3.2: Character Output Using Member Function put
- 19.4: Stream Input
- 19.4: Stream Input
- 19.4.1: get and getline Member Functions
- 19.4.1: get and getline Member Functions
- 19.4.2: istream Member Functions peek, putback and ignore
- 19.4.2: istream Member Functions peek, putback and ignore
- 19.5: Unformatted I/O Using read, write and gcount
- 19.5: Unformatted I/O Using read, write and gcount
- 19.6: Stream Manipulators
- 19.6: Stream Manipulators
- 19.6.1: Integral Stream Base (dec, oct, hex and setbase)
- 19.6.1: Integral Stream Base (dec, oct, hex and setbase)
- 19.6.2: Floating-Point Precision (setprecision, precision)
- 19.6.2: Floating-Point Precision (setprecision, precision)
- 19.6.3: Field Width (width, setw)
- 19.6.3: Field Width (width, setw)
- 19.6.4: User-Defined Output Stream Manipulators
- 19.6.4: User-Defined Output Stream Manipulators
- 19.6.5: Trailing Zeros and Decimal Points (showpoint)
- 19.6.5: Trailing Zeros and Decimal Points (showpoint)
- 19.6.6: Alignment (left, right and internal)
- 19.6.6: Alignment (left, right and internal)
- 19.6.7: Padding (fill, setfill)
- 19.6.7: Padding (fill, setfill)
- 19.6.8: Integral Stream Base (dec, oct, hex, showbase)
- 19.6.8: Integral Stream Base (dec, oct, hex, showbase)
- 19.6.9: Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed)
- 19.6.9: Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed)
- 19.6.10: Uppercase/Lowercase Control (uppercase)
- 19.6.10: Uppercase/Lowercase Control (uppercase)
- 19.6.11: Specifying Boolean Format (boolalpha)
- 19.6.11: Specifying Boolean Format (boolalpha)
- 19.6.12: Setting and Resetting the Format State via Member Function flags
- 19.6.12: Setting and Resetting the Format State via Member Function flags
- 19.7: Stream Error States
- 19.7: Stream Error States
- 19.8: Tying an Output Stream to an Input Stream
- 19.8: Tying an Output Stream to an Input Stream
- 19.9: C++20 Text Formatting
- 19.9: C++20 Text Formatting
- 19.9.1: C++20 std::format Presentation Types
- 19.9.1: C++20 std::format Presentation Types
- 19.9.2: C++20 std::format Field Widths and Alignment
- 19.9.2: C++20 std::format Field Widths and Alignment
- 19.9.3: C++20 std::format Numeric Formatting
- 19.9.3: C++20 std::format Numeric Formatting
- 19.9.4: C++20 std::format Field Width and Precision Placeholders
- 19.9.4: C++20 std::format Field Width and Precision Placeholders
- 19.10: Wrap-Up
- 19.10: Wrap-Up
- 19: Exercises
- 19: Exercises
- 20: Objectives
- 20.1: Introduction
- 20.1: Introduction
- 20.2: shared_ptr and weak_ptr Smart Pointers
- 20.2: shared_ptr and weak_ptr Smart Pointers
- 20.2.1: Reference Counted shared_ptr
- 20.2.1: Reference Counted shared_ptr
- 20.2.2: weak_ptr: shared_ptr Observer
- 20.2.2: weak_ptr: shared_ptr Observer
- 20.3: Runtime Polymorphism with std::variant and std::visit
- 20.3: Runtime Polymorphism with std::variant and std::visit
- 20.4: protected Class Members: A Deeper Look
- 20.4: protected Class Members: A Deeper Look
- 20.5: Non-Virtual Interface (NVI) Idiom
- 20.5: Non-Virtual Interface (NVI) Idiom
- 20.6: Inheriting Base-Class Constructors
- 20.6: Inheriting Base-Class Constructors
- 20.7: Multiple Inheritance
- 20.7: Multiple Inheritance
- 20.7.1: Diamond Inheritance
- 20.7.1: Diamond Inheritance
- 20.7.2: Eliminating Duplicate Subobjects with virtual Base-Class Inheritance
- 20.7.2: Eliminating Duplicate Subobjects with virtual Base-Class Inheritance
- 20.8: public, protected and private Inheritance
- 20.8: public, protected and private Inheritance
- 20.9: namespaces: A Deeper Look
- 20.9: namespaces: A Deeper Look
- 20.9.1: Defining namespaces
- 20.9.1: Defining namespaces
- 20.9.2: Accessing namespace Members with Qualified Names
- 20.9.2: Accessing namespace Members with Qualified Names
- 20.9.3: using Directives Should Not Be Placed in Headers
- 20.9.3: using Directives Should Not Be Placed in Headers
- 20.9.4: Nested Namespaces
- 20.9.4: Nested Namespaces
- 20.9.5: Aliases for namespace Names
- 20.9.5: Aliases for namespace Names
- 20.10: Storage Classes and Storage Duration
- 20.10: Storage Classes and Storage Duration
- 20.10.1: Storage Duration
- 20.10.1: Storage Duration
- 20.10.2: Local Variables and Automatic Storage Duration
- 20.10.2: Local Variables and Automatic Storage Duration
- 20.10.3: Static Storage Duration
- 20.10.3: Static Storage Duration
- 20.10.4: mutable Class Members
- 20.10.4: mutable Class Members
- 20.11: Operator Keywords
- 20.11: Operator Keywords
- 20.12: decltype Operator
- 20.12: decltype Operator
- 20.13: Trailing Return Types for Functions
- 20.13: Trailing Return Types for Functions
- 20.14: [[nodiscard]] Attribute
- 20.14: [[nodiscard]] Attribute
- 20.15: Some Key C++23 Features
- 20.15: Some Key C++23 Features
- 20.16: Wrap-Up
- 20.16: Wrap-Up
- 21: Objectives
- 21.1: Introduction
- 21.1: Introduction
- 21.2: Efficiency of Algorithms: Big O
- 21.2: Efficiency of Algorithms: Big O
- 21.2.1: O(1) Algorithms
- 21.2.1: O(1) Algorithms
- 21.2.2: O(n) Algorithms
- 21.2.2: O(n) Algorithms
- 21.2.3: O(n2) Algorithms
- 21.2.3: O(n2) Algorithms
- 21.3: Linear Search
- 21.3: Linear Search
- 21.3.1: Implementation
- 21.3.1: Implementation
- 21.3.2: Efficiency of Linear Search
- 21.3.2: Efficiency of Linear Search
- 21.4: Binary Search
- 21.4: Binary Search
- 21.4.1: Implementation
- 21.4.1: Implementation
- 21.4.2: Efficiency of Binary Search
- 21.4.2: Efficiency of Binary Search
- 21.5: Insertion Sort
- 21.5: Insertion Sort
- 21.5.1: Implementation
- 21.5.1: Implementation
- 21.5.2: Efficiency of Insertion Sort
- 21.5.2: Efficiency of Insertion Sort
- 21.6: Selection Sort
- 21.6: Selection Sort
- 21.6.1: Implementation
- 21.6.1: Implementation
- 21.6.2: Efficiency of Selection Sort
- 21.6.2: Efficiency of Selection Sort
- 21.7: Merge Sort (A Recursive Implementation)
- 21.7: Merge Sort (A Recursive Implementation)
- 21.7.1: Implementation
- 21.7.1: Implementation
- 21.7.2: Efficiency of Merge Sort
- 21.7.2: Efficiency of Merge Sort
- 21.7.3: Summarizing Various Algorithms’ Big O Notations
- 21.7.3: Summarizing Various Algorithms’ Big O Notations
- 21.8: Wrap-Up
- 21.8: Wrap-Up
- 21: Exercises
- 21: Exercises
- Student Supplemental Materials
UM RAFBÆKUR Á HEIMKAUP.IS
Bókahillan þín er þitt svæði og þar eru bækurnar þínar geymdar. Þú kemst í bókahilluna þína hvar og hvenær sem er í tölvu eða snjalltæki. Einfalt og þægilegt!Rafbók til eignar
Rafbók til eignar þarf að hlaða niður á þau tæki sem þú vilt nota innan eins árs frá því bókin er keypt.
Þú kemst í bækurnar hvar sem er
Þú getur nálgast allar raf(skóla)bækurnar þínar á einu augabragði, hvar og hvenær sem er í bókahillunni þinni. Engin taska, enginn kyndill og ekkert vesen (hvað þá yfirvigt).
Auðvelt að fletta og leita
Þú getur flakkað milli síðna og kafla eins og þér hentar best og farið beint í ákveðna kafla úr efnisyfirlitinu. Í leitinni finnur þú orð, kafla eða síður í einum smelli.
Glósur og yfirstrikanir
Þú getur auðkennt textabrot með mismunandi litum og skrifað glósur að vild í rafbókina. Þú getur jafnvel séð glósur og yfirstrikanir hjá bekkjarsystkinum og kennara ef þeir leyfa það. Allt á einum stað.
Hvað viltu sjá? / Þú ræður hvernig síðan lítur út
Þú lagar síðuna að þínum þörfum. Stækkaðu eða minnkaðu myndir og texta með multi-level zoom til að sjá síðuna eins og þér hentar best í þínu námi.
Fleiri góðir kostir
- Þú getur prentað síður úr bókinni (innan þeirra marka sem útgefandinn setur)
- Möguleiki á tengingu við annað stafrænt og gagnvirkt efni, svo sem myndbönd eða spurningar úr efninu
- Auðvelt að afrita og líma efni/texta fyrir t.d. heimaverkefni eða ritgerðir
- Styður tækni sem hjálpar nemendum með sjón- eða heyrnarskerðingu
- Gerð : 208
- Höfundur : 9686
- Útgáfuár : 2017
- Leyfi : 380