Verbosity in D

Emanuele Torre torreemanuele6 at gmail.com
Sun Aug 7 22:16:55 UTC 2022


On Sunday, 7 August 2022 at 20:15:05 UTC, pascal111 wrote:
> What destructuring binds? I didn't hear about that before.

```C++
#include <iostream>

struct Point {
     int x, y;
};

Point add_points(const Point& a, const Point& b)
{
     return { a.x + b.x, a.y + b.y };
}

int main()
{
     const auto [x, y] = add_points({ 1, 10 }, { -60, 40 });
     std::cout << "x is: " << x << '\n';
     std::cout << "y is: " << y << '\n';
}
```


More information about the Digitalmars-d-learn mailing list