example3_using_with_arrays.cpp

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

int main() {
    std::array<int, 3> coordinates = {1, 2, 3};
    auto [x, y, z] = coordinates;

    std::cout << "X: " << x << ", Y: " << y << ", Z: " << z << std::endl;

    return 0;
}
Back to structured_bindings