Modelling Functions in C++
This chapter first defines what a function is and then discusses the various ways to model functions in C++. The new features are to be found in the C++ standard and are essentially based on the functional programming model, allowing the developers to write code that is more flexible than code based...
Saved in:
| Published in | Financial Instrument Pricing Using C++ pp. 59 - 87 |
|---|---|
| Main Author | |
| Format | Book Chapter |
| Language | English |
| Published |
United Kingdom
John Wiley & Sons, Incorporated
2018
Wiley |
| Subjects | |
| Online Access | Get full text |
| ISBN | 0470971193 9780470971192 |
| DOI | 10.1002/9781119170518.ch3 |
Cover
| Summary: | This chapter first defines what a function is and then discusses the various ways to model functions in C++. The new features are to be found in the C++ standard and are essentially based on the functional programming model, allowing the developers to write code that is more flexible than code based exclusively on subtype polymorphism. The chapter shows examples of these features. The developers can integrate functions, data types and data containers to form generic and reusable structures for numerical applications. A callable object is a general name given to different ways to define functions in C++: A free function; a pointer to a member function; a function object; a lambda function; and a static member function. From a design point of view, the developers wish to write code once by using std::function as the most general way to declare callable objects. The chapter further focuses on the function adapters and binders. |
|---|---|
| ISBN: | 0470971193 9780470971192 |
| DOI: | 10.1002/9781119170518.ch3 |