example1_basic_usage_with_tuple.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <iostream>
#include <tuple>

int main() {
    std::tuple<int, double, std::string> person(30, 1.75, "John Doe");
    auto [age, height, name] = person;

    std::cout << "Name: " << name << ", Age: " << age << ", Height: " << height << " m" << std::endl;

    return 0;
}
Back to structured_bindings