Tuples in C++ and their Applications

In a programming language, a tuple is a data object containing other objects as elements or members. These elements may be of different types. This chapter gives a mathematical introduction to the concept of a tuple (or n‐tuple) which is an ordered set of n elements or components of heterogeneous ty...

Full description

Saved in:
Bibliographic Details
Published inFinancial Instrument Pricing Using C++ pp. 123 - 145
Main Author Duffy, Daniel J
Format Book Chapter
LanguageEnglish
Published United Kingdom John Wiley & Sons, Incorporated 2018
Wiley
Subjects
Online AccessGet full text
ISBN0470971193
9780470971192
DOI10.1002/9781119170518.ch5

Cover

More Information
Summary:In a programming language, a tuple is a data object containing other objects as elements or members. These elements may be of different types. This chapter gives a mathematical introduction to the concept of a tuple (or n‐tuple) which is an ordered set of n elements or components of heterogeneous type where n is a non‐negative integer. It then describes the main language features of std::tuple and reviews the functionality in std::pair (which is a 2‐tuple) and by giving examples of the new features in C++11. The chapter also gives a discussion on how to avoid possible run‐time performance bottlenecks when using std::tuple in the wrong way. It then discusses two libraries that offer similar functionality to std::tuple: Boost Tuple; and Boost Fusion. Furthermore, the chapter investigates the consequences of using tuples as return types of, and as input arguments to, functions. Finally, it summarizes the advantages and applications of tuples.
ISBN:0470971193
9780470971192
DOI:10.1002/9781119170518.ch5