| 59 | }; |
| 60 | |
| 61 | int main() |
| 62 | { |
| 63 | Point p = Point{1, 2}; |
| 64 | auto& [x, y] = p; |
| 65 | |
| 66 | printf("x:%lf y:%lf\n", p.GetX(), p.GetY()); |
| 67 | ++x; |
| 68 | ++y; |
| 69 | printf("x:%lf y:%lf\n", x, y); |
| 70 | printf("x:%lf y:%lf\n", p.GetX(), p.GetY()); |
| 71 | |
| 72 | constexpr Point p2 = Point{3, 4}; |
| 73 | auto& [x2, y2] = p2; |
| 74 | |
| 75 | // error: decomposition declaration cannot be declared 'constexpr' |
| 76 | // constexpr auto [x3, y3] = p2; |
| 77 | } |