A lot of financial modeling has gravitated toward Python, R, and VBA, but many developers hit a wall with these languages when it comes to performance. This practical book demonstrates why C++ is still one of the dominant production-quality languages for financial applications and systems. Many programmers believe that C++ is too difficult to learn. Author Daniel Hanson demonstrates that this is no longer the case. Financial programmers coming from Python or another interpreted language will discover how to leverage C++ abstractions that enable safer and quicker implementation of financial models. You'll also explore how popular open source libraries provide additional weapons for attacking mathematical problems. C++ programmers unfamiliar with financial applications will also benefit from this handy guide. Before launching into programming in C++, it will be useful to present a brief overview of the language the C++ Standard Library, and the ways in which C++ continues to have a major presence in quantitative finance. You may have already felt intimidated by opinions and rumors claiming that C++ is extraordinarily difficult to learn and fraught with minefields. So, in this chapter, we will try to allay these fears by first debunking some of the common myths about C++, and then presenting straightforward examples to help you get up and running. Learn C++ basics: syntax, inheritance, polymorphism, composition, STL containers, and algorithms Dive into newer features and abstractions including functional programming using lambdas, task-based concurrency, and smart pointers Employ common but nontrivial financial models in modern C++ Explore external open source math libraries, particularly Eigen and Boost Implement basic numerical routines in modern C++ Understand best practices for writing clean and efficient code 1. An Overview of C++ C++ and Quantitative Finance C++ 11: The Modern Era is Born Open Source Mathematical Libraries Debunking Myths About C++ Compiled vs Interpreted Code The Components of C++ C++ Language Features The C++ Standard Library Compilers and IDE’s Basic Review of C++ Good Old “Hello World!” Simple Procedural Programming in C++ C++ Syntax and Style Guidelines Mathematical Operators, Functions, and Constants in C++ Standard Arithmetic Operators Mathematical Functions in the Standard Library Constants Conclusion References 2. Some Mechanics of C++ The `vector` Container Setting and Accessing Elements of a `vector` Concluding Remarks on STL `vector`s Enum Constants and Classes Enum Constants Potential Conflicts with Enums Enum Classes Control Structures Conditional Branching Iterative Statements Aliases Type Aliases References Pointers Function and Operator Overloading Function Overloading Operator Overloading Summary References 3. Writing User-Defined Functions and Classes in Modules Using Modules to Write User-Defined Functions A First Example with Non-Member Functions Standard Library Header Units Modules Prevent Leaking into Other Modules A Black-Scholes Module Example User-Defined Class Implementation in Modules Using Namespaces with Modules Summary 4. Dates and Fixed Income Securities Representation of a Date 1.1 Serial Representation and Date Differences 1.2 Accessor Functions for Year, Month, and Day 1.3 Validity of a Date 1.4 Leap Years and Last Day of the Month 1.5 Weekdays and Weekends 1.6 Adding Years, Months, and Days 1.6.1 Adding Years 1.6.2 Adding Months and End-of-the-Month Cases 1.6.3 Adding Days A Date Class Wrapper Class Declaration Public Member Functions and Operators Private Members and Helper Function Class Implementation Day Count Bases Yield Curves Deriving a Yield Curve from Market Data A Yield Curve Class A Linearly Interpolated Yield Curve Class Implementation A Bond Class Bond Payments and Valuation A Bond Class Bond Class Implementation A Bond Valuation Example Summary References 5. Linear Algebra Introduction valarray and Matrix Operations Arithmetic Operators and Math functions valarray as a Matrix Proxy Eigen Lazy Evaluation Eigen Matrices and Vectors Matrix and Vector Math Operations STL Compatibility Matrix Decompositions and Applications Future Directions: Linear Algebra in the Standard Library mdspan (P0009) BLAS Interface (P1673) Linear Algebra (P1385) Summary (Linear Algebra Proposals) Chapter Summary References About the Author