Robert Jacques: > The proposed unpacking syntax, IIRC, was: > > (double a, int b) = fun(); > > which lowered to: > > auto __tup = fun(); > double x = __tup[0]; // __tup[0] has a type that is implicitly convertible > to double > int y = __tup[1]; // ditto > > Why not instead lower to: > > auto __tup = fun(); > double x = __tup.tupleof[0]; > int y = __tup.tupleof[1];
The advange of lowering it to: > auto __tup = fun(); > double x = __tup[0]; Is that it works with this too: int[2] foo() { return [10,20; } auto (x,y) = foo(); This case is quite common. Bye, bearophile