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...
Gespeichert in:
1. Verfasser: | |
---|---|
Format: | Buchkapitel |
Sprache: | eng |
Schlagworte: | |
Online-Zugang: | Volltext |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | 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. |
---|---|
DOI: | 10.1002/9781119170518.ch5 |