Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Title Page
Copyright and Credits
Expert C++
Dedication
About Packt
Why subscribe?
Contributors
About the authors
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Section 1: Under the Hood of C++ Programming
Introduction to Building C++ Applications
Technical requirements
Introduction to C++20
Concepts
Coroutines
Ranges
More C++20 features
Building and running programs
Understanding preprocessing
Header files
Using modules in C++20
Understanding Compiling
Tokenization
Syntax analysis
Semantic analysis
Intermediate code generation
Optimization
Machine code generation
Platforms and object files
Introducing Linking
Linking libraries
Summary
Questions
Further reading
Low-Level Programming with C++
Technical requirements
Program execution
main()
Special properties of main()
constexpr
Recursion
Working with data
Virtual memory
Addressing
Data types
Pointers
Memory segments
The heap
Arrays
Control flow
Conditionals
The switch statement
Replacing conditionals with function pointers
Functions as types
Loops
Summary
Questions
Further reading
Details of Object-Oriented Programming
Technical requirements
Understanding objects
Low-level details of objects
High-level details of objects
State
Identity
Behavior
Mimicking a class
Working with classes
Classes from the compiler perspective
Initialization and destruction
Copying objects
Moving objects
Lvalue references
Rvalue references
Notes on operator overloading
Encapsulation and the public interface
Structs in C++
Class relationships
Aggregation and composition
Inheritance
Inheritance from the compiler perspective
Composition versus inheritance
Protected inheritance
Polymorphism
Virtual functions under the hood
Design patterns
Summary
Questions
Further reading
Understanding and Designing Templates
Technical requirements
Exploring function and class templates
Motivation
Function templates
Syntax
Instantiation
Explicit instantiations
Implicit instantiations
Deduction
Specialization and overloading
Class templates
Syntax
Instantiation
Explicit instantiation
Implicit 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
Template non-type arguments
Template type arguments
Template template arguments
Default template arguments
Exploring traits
Type trait implementation
boost::is_void
boost::is_pointer
Optimizing algorithms using traits
Exploring template metaprogramming
Compile-time computation
Compile-time code optimization
Static polymorphism
Summary
Questions
Further reading
Memory Management and Smart Pointers
Technical requirements
Understanding computer memory
Designing a memory storage device
Understanding computer memory from a higher-level perspective
Registers
Cache memory
Main memory
Permanent storage
The basics of memory management
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
Summary
Questions
Further reading
Section 2: Designing Robust and Efficient Applications
Digging into Data Structures and Algorithms in STL
Technical requirements
Data structures
Sequential data structures
Node-based data structures
Containers in memory
STL containers
Using std::vector and std::list
Using container adapters
Iterating containers
Concepts and iterators
Understanding concepts
Using iterators in C++20
Mastering algorithms
Searching
Binary search
Sorting
Exploring trees and graphs
Hash tables
Graphs
Strings
Summary
Questions
Further reading
Functional Programming
Technical requirements
Unveiling functional programming
Using ranges
Why use functional programming?
Principles of functional programming
Pure functions
Higher-order functions
Folding
Diving deeper into recursion
Head recursion
Tail recursion
Metaprogramming in functional C++
Summary
Questions
Further reading
Concurrency and Multithreading
Technical requirements
Understanding concurrency and multithreading
Processes
Challenges with 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
Designing Concurrent Data Structures
Technical requirements
A closer look at data races
A synchronized increment
Implementing a thread-safe stack
Designing lock-free data structures
Using atomic types
Operations on atomic types
Designing a lock-free stack
More operations on atomics
Summary
Questions
Further reading
Designing World-Ready Applications
Technical requirements
Project development life cycle
Requirements gathering and analysis
Specification creation
Design and test planning
Decomposing entities
Coding
Testing and stabilization
Release and maintenance
Diving into the design process
Using SOLID principles
The single responsibility principle
The open-closed principle
The Liskov substitution principle
The interface segregation principle
The dependency inversion principle
Using domain-driven design
Leveraging design patterns
The repository pattern
The factory pattern
Summary
Questions
Further reading
Designing a Strategy Game Using Design Patterns
Technical requirements
Introduction to game design
Introduction to the Readers and Disturbers game
Strategy game components
Interaction between the components
Designing the game
Designing character units
Designing buildings
Designing game controllers
Concurrent actions
The game event loop
Using design patterns
The Command pattern
The Observer pattern
The Flyweight pattern
The Prototype pattern
Designing the game loop
Summary
Questions
Further reading
Networking and Security
Technical requirements
Discovering network programming in C++
Network applications under the hood
Programming network applications using sockets
Network protocols
Designing a network application
Using POSIX sockets
Implementing a POSIX socket wrapper class
Securing the C++ code
Securing network applications
Summary
Questions
Further reading
Debugging and Testing
Technical requirements
Understanding the root cause of an issue
The RCA overview
Prevention is better than the cure – a good coding behavior
Uninitialized variable problem
Side effects in compound expressions
Mixing signed and unsigned problems
Order of evaluation problem
Compile-time checking versus runtime checking
Avoiding memory leaks
Debugging C++ programs
Tools to debug a C/C++ program
GDB overview
Examples of GDB
Setting breakpoints and inspection variable values
Function breakpoints, conditional breakpoints, watchpoint, and the continue and finish commands
Logging gdb into a text file
Practical debugging strategies
Understanding static and dynamic analysis
Static analysis
Dynamic analysis
Exploring unit testing, TDD, and BDD
Unit testing
TDD
Example of TDD
Step 1 – writing a failing test
Step 2 – developing code to let the test pass
Step 3 – refactoring
BDD
Summary
Further reading
Exercises and questions
Graphical User Interface with Qt
Technical requirements
Understanding cross-platform GUI programming
Using C++ as Java
Qt's cross-platform model
Writing a simple application
Discovering Qt
Grasping signals and slots
Understanding Model/View programming
Using Qt widgets
Common Qt widgets
Composing widgets using layouts
Summary
Questions
Further reading
Section 3: C++ in the AI World
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
Implementing a Dialog-Based Search Engine
Technical requirements
Understanding the structure of a search engine
Providing a convenient user interface
Dealing with typos in queries
Crawling websites
Indexing documents
Tokenizing documents
Sorting the results
Building a recommendation engine
Using a knowledge graph
Implementing a dialog-based search engine
Implementing the query parser
Implementing the query processor
Summary
Questions
Further reading
Assessments
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Other Books You May Enjoy
Leave a review - let other readers know what you think
← Prev
Back
Next →
← Prev
Back
Next →