Appendix C. C++ for Non-C++ Programmers

This book generally uses a subset of C++ that should be easily understandable to most programmers who have used a language like C or Java. However, there are a few important features and idioms specific to C++ that we rely on. These are described in this Appendix. Except where noted, we use only features of C++ that have been available in the 1998 standard version of the language. For a good brief introduction to C++11, see A Tour of C++ by Bjarne Stroustrup. For a complete reference, see Stroustrup’s The C++ Programming Language.

C.1 Template Functions

One way C++ supports the generic programming paradigm is through the use of templates. Suppose you have a function like this:

int my_function(int x) { ...

Get From Mathematics to Generic Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.