example2_using_with_custom_structures.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>

struct Point {
    double x;
    double y;
};

Point getPoint() {
    return {3.14, 2.71};
}

int main() {
    auto [x, y] = getPoint();
    std::cout << "X: " << x << ", Y: " << y << std::endl;

    return 0;
}
Back to structured_bindings