Автор: Daniel Hanson
Издательство: O’Reilly Media, Inc.
Год: 2025
Страниц: 481
Язык: английский
Формат: pdf, epub
Размер: 10.1 MB
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, thanks to modern features added to the C++ Standard beginning in 2011.
Financial programmers will discover how to leverage C++ abstractions that enable safe 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 also benefit from this handy guide.
Learn C++ basics from a modern perspective: 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
Implement basic numerical routines in modern C++
Understand best practices for writing clean and efficient code
Chapter 1, “An Overview of C++” provides an overview of C++, beginning with a brief history of C++ in finance, and the shift toward modern C++, beginning with C++11. It also covers the separation of the core language and the C++ Standard Library, followed by key modern updates to the language that will be used throughout the remainder of the book, such as automatic type deduction, range-based for loops, scoped enumerations, and lambda expressions. It also includes coverage of basic mathematical features within the core language and the Standard Library. It concludes with a discussion about coding style and standards, and those that will be followed in this book.
Chapter 2, “Writing User-Defined Classes with Modern C++ Features” and Chapter 3, “Inheritance, Polymorphism, and Smart Pointers” are focused on object-oriented features in C++, and modern additions that have changed (and have helped improve) the methods once commonly employed in C++ for implementing composition and inheritance. Chapter 2 is primarily concerned with composition, namely the storage of a private data member that is itself an object, and how move semantics introduced in C++11 can make this more efficient by avoiding object copy at construction of the enclosing object. It also covers the new C++20 three-way operator (also called the spaceship operator), which greatly streamlines implementation of equality and inequality operators. Chapter 3 begins with modern features that better facilitate inheritance and dynamic polymorphism. It then shifts back to composition, where the subobject member is now a pointer resource, and how smart pointers help eliminate the problems associated with raw pointers. Composition and inheritance are then tied together in a modern context where the resource is a smart pointer to a polymorphic object. Financial examples in both chapters are related to option pricing.
...
Chapter 10, “Modules and Concepts” covers two more recent features included in C++20: modules and concepts. Modules unfortunately have gotten off to a slow start, with some compilers only recently nearing completion of their implementation. On the other hand, they bring a more modern touch to C++ software design and implementation, with cleaner and safer code, increased productivity, and in some cases reduced compile times. Furthermore, it is my opinion that once modules become more mainstream, they will provide a huge benefit to those learning C++, as they will be able to get up and running more quickly. In contrast, concepts have been quickly adopted by developers and were a long awaited enhancement. Concepts give programmers more control over template programming, particularly pinpointing compile-time errors that in preceding years might be buried among an avalanche of cryptic errors. They also lend clarity to code, in a sense helping it to be better self-documenting. Concepts can be user-defined, while a robust set of predefined concepts, based on C++11 type traits, is provided by the Standard Library as of C++20.
Скачать Learning Modern C++ for Finance: Foundations for Quantitative Programming (Final Release)