Namespaces
Variants
Actions

std::tuple

From cppreference.com
< cpp‎ | utility
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)  
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
tuple
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)


 
 
Defined in header <tuple>
template< class... Types >
class tuple;
(since C++11)

Class template std::tuple is a fixed-size collection of heterogeneous values. It is a generalization of std::pair.

If std::is_trivially_destructible<Ti>::value is true for every Ti in Types, the destructor of std::tuple is trivial.

If a program declares an explicit or partial specialization of std::tuple, the program is ill-formed, no diagnostic required.

Contents

[edit] Template parameters

Types... - the types of the elements that the tuple stores. Empty list is supported.

[edit] Member functions

constructs a new tuple
(public member function) [edit]
assigns the contents of one tuple to another
(public member function) [edit]
swaps the contents of two tuples
(public member function) [edit]

[edit] Non-member functions

creates a tuple object of the type defined by the argument types
(function template) [edit]
(C++11)
creates a tuple of lvalue references or unpacks a tuple into individual objects
(function template) [edit]
creates a tuple of forwarding references
(function template) [edit]
(C++11)
creates a tuple by concatenating any number of tuples
(function template) [edit]
tuple accesses specified element
(function template) [edit]
(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(C++20)
lexicographically compares the values in the tuple
(function template) [edit]
specializes the std::swap algorithm
(function template) [edit]

[edit] Helper concepts

specifies that a type implemented the tuple protocol
(std::get, std::tuple_element, std::tuple_size)
(exposition-only concept*)[edit]

[edit] Helper classes

obtains the size of

a tuple
(class template specialization) [edit]