Declaring Ref Variables Inside Function Calls

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Mar 31 11:34:12 PDT 2009


On Tue, Mar 31, 2009 at 1:32 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Jarrett Billingsley wrote:
>>
>> 2009/3/30 dsimcha <dsimcha at yahoo.com>:
>>>
>>> // How it works now:
>>> uint foo;
>>> string bar;
>>> unpack(foo, bar) = someFunction();
>>>
>>> // vs. how I want it to work:
>>> unpack(auto foo, auto bar) = someFunction();
>>
>> Cute, but uh, I'd much rather see tuples just be returnable.
>
> They are.

template Tuple(T...)
{
	alias T Tuple;
}

Tuple!(int, float) foo()
{
	return Tuple!(3, 4.5);
}

foo.d(10): Error: functions cannot return a tuple

Unless you're using some prerelease compiler, they are not.



More information about the Digitalmars-d mailing list