Buy 2+, save 55% on books & eBooks through December 1. Use code BOOKSGIVING. Learn more.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Adobe® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Also available in other formats.
Register your product to gain access to bonus material or receive a coupon.
As scientific and engineering projects grow larger and more complex, more are being written in C++. With embedded hardware growing more powerful, much of its software is moving to C++, too. When you master C++, you’ll gain strong skills for programming at nearly every level, from “close to the hardware” to the highest-level abstractions. In short, C++ is a language that scientific and technical practitioners need to know.
Peter Gottschling’s Discovering Modern C++, Second Edition is an intensive introduction that guides you smoothly to sophisticated approaches based on advanced features. Thoroughly updated for C++17 and C++ 20, this Second Edition introduces key concepts using examples from many technical problem domains, drawing on his extensive experience training professionals and teaching C++ to students of physics, math, and engineering.
This book is designed to help you get started rapidly and then master increasingly robust features, from lambdas to expression templates. You’ll also learn how to take advantage of the powerful libraries available to C++ programmers: both the Standard Template Library (STL) and scientific libraries for arithmetic, linear algebra, differential equations, and graphs. In this Second Edition, Gottschling also presents thorough and expert coverage of multi-threading and variadic templates.
Throughout, Gottschling demonstrates how to write clear and expressive software using object orientation, generics, metaprogramming, and procedural techniques. By the time you’re finished, you’ll have mastered all the abstractions you need to write C++ programs with exceptional quality and performance.
Download the code files from the author's GitHub site: https://github.com/petergottschling/dmc3
Download the sample pages (includes Chapter 1)
Chapter 1 C++ Basics
1.1 Our First Program
1.4 Expressions and Statements
1.6 Error Handling
1.8 Arrays, Pointers, and References
1.9 Structuring Software Projects
Chapter 2 Classes
2.5 Method Generation R´esum´e
2.6 Accessing Member Variables
2.7 Operator Overloading Design
Chapter 3 Generic Programming
3.1 Function Templates
3.2 Namespaces and Function Lookup
3.3 Class Templates
3.4 Type Deduction and Definition
3.5 A Little Bit of Theory on Templates: Concepts
3.6 Template Specialization
3.7 Non-Type Parameters for Templates
3.10 Variable Templates
3.11 Variadic Templates
Chapter 4 Libraries
4.1 Standard Template Library
4.5 The Time Is Now
4.7 Scientific Libraries Beyond the Standard
Chapter 5 Meta-Programming
5.1 Let the Compiler Compute
5.2 Providing and Using Type Information
5.3 Expression Templates
5.4 Meta-Tuning: Write Your Own Compiler Optimization
5.5 Turing Completeness
Chapter 6 Object-Oriented Programming
6.1 Basic Principles
6.2 Removing Redundancy
6.3 Multiple Inheritance
6.4 Dynamic Selection by Sub-typing
Chapter 7 Scientific Projects
7.1 Implementation of ODE Solvers
7.2 Creating Projects
7.3 Some Final Words
Appendix A Clumsy Stuﬀ
A.1 More Good and Bad Scientific Software
A.2 Basics in Detail
A.2.4 Duﬀ’s Device
A.2.5 More about main
A.3 Real-World Example: Matrix Inversion
A.4 Class Details
A.5 Method Generation
A.5.1 Controlling the Generation
A.5.2 Generation Rules
A.5.3 Pitfalls and Design Guides
A.6 Template Details
A.6.1 Uniform Initialization
A.6.2 Which Function Is Called?
A.6.3 Specializing for Specific Hardware
A.6.4 Variadic Binary I/O
A.7 Using std::vector in C++03
A.7.1 Using std::vector in C++03
A.8 Dynamic Selection in Old Style
A.9 Meta-Programming Details
A.9.1 First Meta-Program in History
A.9.3 Backward-Compatible Static Assertion
A.9.4 Anonymous Type Parameters
A.9.5 Benchmark Sources of Dynamic Unrolling
A.9.6 Benchmark for Matrix Product
Appendix B Programming Tools
B.2.1 Text-Based Debugger
B.2.2 Debugging with Graphical Interface: DDD
B.3 Memory Analysis
B.5 Unix, Linux, and Mac OS
Appendix C Language Definitions
C.1 Value Categories
C.2 Operator Overview
C.3 Conversion Rules
C.3.2 Other Conversions
C.3.3 Usual Arithmetic Conversions