Tuple expansion already?

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 17 20:31:06 PST 2015


On Wednesday, 18 November 2015 at 02:19:34 UTC, Ali Çehreli wrote:
> For once, let's take something from C++. ;) Structured bindings 
> are accepted for C++:
>
>   https://isocpp.org/blog/2015
>
> Assuming that f() returns a tuple,
>
>   auto {x,y,z} = f();
>
> will be the same as
>
>   auto t = f();
>   auto x = get<1>(t);
>   auto y = get<2>(t);
>   auto z = get<3>(t);
>
> Ali

I feel like some of the competitive advantage of D is falling 
away from us with some of the recent C++ developments like this 
this. Stackless resumable functions is another thing that comes 
to mind. As does the Core Guidelines Support Library/static 
analysis pair (though I suspect it'll never be quite as foolproof 
as Safe D).

We can't even do the equivalent of std::tie[1] in D as a 
workaround for tuple expansion because there are no ref typed 
Tuples (unless something changed from when I last looked).

http://en.cppreference.com/w/cpp/utility/tuple/tie


More information about the Digitalmars-d mailing list