Verbosity in D

pascal111 judas.the.messiah.111 at gmail.com
Sun Aug 7 23:31:45 UTC 2022


On Sunday, 7 August 2022 at 22:16:55 UTC, Emanuele Torre wrote:
> 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';
> }
> ```

It seems complex, I didn't get it yet, I wished I didn't ask 
about it :)


More information about the Digitalmars-d-learn mailing list