# **[](https://en.cppreference.com/w/cpp/header/tuple)** provides `std::tuple`, a heterogeneous fixed-size container holding values of different types. Use `std::get(t)` to access by index or `std::get(t)` to access by type. C++17 structured bindings (`auto [x, y] = tuple`) make tuples convenient. Tuples are useful for returning multiple values from a function without defining a struct. ## Example This example returns multiple values of different types from a function via tuple, using structured bindings to unpack them. ```cpp // compile: g++ -std=c++17 -o tupleexample tupleexample.cpp // run: ./tupleexample // description: tuple creation and unpacking #include #include #include std::tuple fetch_data() { return {42, 3.14, "hello"}; } int main() { auto [i, d, s] = fetch_data(); std::cout << "int: " << i << ", double: " << d << ", string: " << s << "\n"; return 0; } ```