Chapter 21. Tuples

Ru-Brd

Throughout this book we often use homogeneous containers and array-like types to illustrate the power of templates. Such homogeneous structures extend the concept of a C/C++ array and are pervasive in most applications. C++ (and C) also has a nonhomogeneous containment facility: the class (or struct). Tuples are class templates that similarly allow us to aggregate objects of differing types. We start with the duo ”an entity analogous to the standard std::pair template ”but we also show how it can be nested to assemble an arbitrary number of members , thereby forming trios, quartets, and so forth. [1]

[1] The number is not entirely arbitrary because there exists an implementation-dependent limit on the depth of template nesting.

Ru-Brd


C++ Templates
C++ Templates: The Complete Guide
ISBN: 0201734842
EAN: 2147483647
Year: 2002
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net