On 03/10/2012 05:26 AM, Andrei Alexandrescu wrote:
On 3/9/12 4:10 PM, Timon Gehr wrote:
(int, int) foo(int a, int b){return (a,b);}
assert(foo(foo(foo(foo(1,2))))==(1,2));
(int, int) goo(int a, int b, int c){return (a+b, c);}
assert(goo(foo(2,3),1) == (5,1));
This is a recipe for disaster because of the implicit expansion.
Consider forwarding the result of foo to some template. Should the
template take the tuple type, or automatically expand the tuple and
accept individual values?
Andrei
That is how built-in tuples behave. I don't feel strongly for or against
it, but consistency should be preserved. What would be a scenario that
demonstrates disaster striking?