Expert C++: Become a proficient programmer by learning coding best practices with C++17 and C++20's latest features [2 ed.] 1804617830, 9781804617830

Take your C++ skills to the next level with expert insights on advanced techniques, design patterns, and high-performanc

147 43 13MB

English Pages 604 Year 2023

Report DMCA / Copyright

DOWNLOAD EPUB FILE

Table of contents :
Cover
Title Page
Copyright and Credits
Contributors
About the reviewers
Table of Contents
Preface
Part 1: Under the Hood of C++ Programming
Chapter 1: Building C++ Applications
Technical requirements
Building C++ applications
Preprocessing
Compiling
Linking
Low-level programming with C++
Functions
Data and memory
Control flow
Details of OOP
Class relationships
Summary
Chapter 2: Beyond Object-Oriented Programming
Technical requirements
An introduction to OOP and the C++ object model
Understanding objects
Low-level details of objects
High-level details of objects
C++ object model
State
Identity
Behavior
Mimicking a class
Working with classes
Classes from a compiler perspective
Initialization and destruction
Copying objects
Moving objects
An lvalue reference
Rvalue references
Notes on operator overloading
Encapsulation and the public interface
Class relationships
Aggregation and composition
Under the hood of inheritance and polymorphism
Inheritance
Polymorphism
Virtual functions under the hood
Classical design patterns
The composite pattern
The decorator pattern
Design principles
The single responsibility principle
The open-closed principle
The Liskov substitution principle
The interface segregation principle
The dependency inversion principle
More UML in project design
The sequence diagram
Summary
Questions
Further reading
Chapter 3: Understanding and Designing Templates
Technical requirements
Motivation for using templates
Function templates
Syntax
Instantiation
Deduction
Specialization and overloading
Class templates
Syntax
Instantiation
Specialization
Understanding variadic templates
Syntax
Examples
Exploring template parameters and arguments
Template parameters
Non-type template parameter
Type template parameter
Template template parameter
Template arguments
Traits
Type trait implementation
Optimizing algorithms using traits
TMP and its applications
Summary
Questions
Further reading
Chapter 4: Template Meta Programming
Technical requirements
Back to basics (compile-time programming with templates)
Compile-time evaluation using constexpr
Constant expression-specified constructors (constexpr)
SFINAE AND enable_if
Argument substitution failure
Disabling templates with enable_if
Type traits
isFundamental
isArithmetic
isScalar
isConst
isVolatile
isPolymorphic
isAbstract
is_signed
Summary
Questions
Chapter 5: Memory Management and Smart Pointers
Technical requirements
Understanding computer memory
Designing a memory storage device
Understanding computer memory from a higher-level perspective
An example of memory management
Using smart pointers
Leveraging the RAII idiom
std::unique_ptr
std::shared_ptr and std::weak_ptr
Garbage collection
Using allocators
Types of allocators
Summary
Questions
Part 2: Designing Robust and Efficient Applications
Chapter 6: Digging into Data Structures and Algorithms in STL
Technical requirements
Sequential data structures
STL containers
Iterating containers
Concepts and iterators
Understanding concepts
Using iterators in C++20
Node-based data structures
Graphs and trees
Trees
Graphs
Hash tables
Algorithms
Search algorithms
Sorting
Summary
Further reading
Questions
Chapter 7: Advanced Data Structures
Technical requirements
B-trees
Searching
Insertion
Deletion
Implementation details of std::unordered_map
How std::unordered_map organizes element storing and how elements are inserted into or searched in std::unordered_map
Hash functions and strategies that are used to implement them
Digit selection
Folding
Using modulo
Collisions and how they are handled
Heaps and their applications
Advanced lists
Skip lists
XOR lists
Summary
Questions
Further reading
Chapter 8: Functional Programming
Technical requirements
Functional programming revealed
Using ranges
First-class and higher-order functions
Why use functional programming?
Principles of functional programming
Pure functions
Folding
Delving more deeply into recursion
Head recursion
Tail recursion
Metaprogramming in functional C++
Summary
Questions
Further reading
Chapter 9: Concurrency and Multithreading
Technical requirements
Understanding concurrency and multithreading
Processes
Threads
Working with threads
Waiting for threads
Using std::jthread
Passing arguments to the thread function
Managing threads and sharing data
Sharing data
Protecting shared data using a mutex
Avoiding deadlocks
Designing concurrent code
Introducing coroutines
Summary
Questions
Further reading
Chapter 10: Designing Concurrent Data Structures
Technical requirements
Thread safety
Lock-based concurrent data structures
A thread-safe singleton pattern
Synchronized counters
Concurrent stacks
Lock-free concurrent data structures
Using atomic types
Operations on atomic types
Lock-free stacks
A lock-free queue
A lock-free hashtable
A lock-free set
More operations on atomics
Summary
Questions
Further reading
Chapter 11: Designing World-Ready Applications
Technical requirements
Design patterns
Singleton
Factory
Adapter
Composite
Observer
Command
Applying design patterns
The problem
Trade-offs
Systemwide impact
Users
Using domain-driven design
An example of a real-world project
Summary
Questions
Further reading
Chapter 12: Incorporating Design Patterns in C++ Applications
Technical requirements
Design patterns in game development
The singleton pattern
The factory pattern
The flyway pattern
Design patterns in data-intensive applications
The proxy pattern
The decorator pattern
The iterator pattern
Design patterns in enterprise applications
SOA
Summary
Questions
Further reading
Chapter 13: Networking and Security
Technical requirements
Introduction to networks, the OSI model, and network programming using sockets
The OSI model
Network applications under the hood
Programming network applications using sockets
Understanding network protocols
Designing an echo server
Securing applications
Securing network applications
Summary
Questions
Further reading
Chapter 14: Debugging and Testing
Technical requirements
Understanding the root cause of an issue
RCA overview
Prevention is better than cure – good coding behavior
The uninitialized variable problem
Side effects in compound expressions
Mixed signed and unsigned problems
Order of evaluation problem
Compile-time checking versus runtime checking
Avoiding memory leaks
Debugging programs
Tools for debugging a C/C++ program
GDB overview
Examples of GDB
Setting breakpoints and inspection variable values
Practical debugging strategies
Static and dynamic analysis
Static analysis
Dynamic analysis
Testing, TDD, and BDD
Unit testing
TDD
BDD
Summary
Further reading
Chapter 15: Large-Scale Application Design
Technical requirements
The introduction of large-scale, cross-platform project organizing
Large-scale, cross-platform project organization in C++
A large-scale, cross-platform project in C++
Best practices and strategies for managing a large-scale, cross-platform project in C++
Horizontal and vertical scaling
Horizontal scaling
Vertical scaling
Scaling C++ applications
Horizontal scaling in C++
Vertical scaling in C++
Designing data-intensive applications
Data structure
Data processing
The main function
Summary
Questions
Further reading
Part 3: C++ in the AI World
Chapter 16: Understanding and Using C++ in Machine Learning Tasks
Technical requirements
Introduction to AI
Computer vision
NLP
Knowledge reasoning
ML
Understanding ML
Designing an algorithm that learns
Categories of ML
Applications of ML
Neural networks
Clustering
Regression analysis
C++ and ML
Summary
Questions
Further reading
Chapter 17: Using C++ in Data Science
Technical requirements
Introduction to data science
C++ example
Data capturing and manipulation
C++ example
Data cleansing and processing
C++ example
Applying machine learning algorithms
C++ example
Data visualization
C++ example
Summary
Questions
Further reading
Chapter 18: Designing and Implementing a Data Analysis Framework
Technical requirements
Using and processing statistical data types
C++ example
Working with tabular and rectangular data
C++ example
A complete ETL pipeline design strategy
C++ example
Summary
Questions
Further reading
Index

Expert C++: Become a proficient programmer by learning coding best practices with C++17 and C++20's latest features [2 ed.]
 1804617830, 9781804617830

  • Commentary
  • Publisher ePUB | Published: August 2023
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
Recommend Papers