Tuples are objects that pack elements of -possibly- different types together in a single object, just like pair objects do for pairs of elements, but generalized for any number of elements.
Conceptually, they are similar to plain old data structures (C-like structs) but instead of having named data members, its elements are accessed by their order in the tuple.
The selection of particular elements within a tuple is done at the template-instantiation level, and thus, it must be specified at compile-time, with helper functions such as get and tie.
The tuple class is closely related to the pair class (defined in header <utility>): Tuples can be constructed from pairs, and pairs can be treated as tuples for certain purposes.
array containers also have certain tuple-like functionalities.
- Tuple (class template)
- Tuple size traits (class template)
- Tuple element type (class template)
- Construct tuple (function template)
- Forward as tuple (function template)
- Tie arguments to tuple elements (function template)
- Concatenate tuples (function template)
- Get element (function template)
- Ignore assignment (object)