function returning a tuple
Russell Lewis
webmaster at villagersonline.com
Mon Mar 17 04:55:56 PDT 2008
Extrawurst wrote:
> - Functions returning Tuples -
>
> Is this planned to be implemented in D2.x ?
While I look forward to the day when this is eventually supported by the
language, you can already do it by hand. I have this common template
which I include in my projects:
struct Structize(TYPE_TUPLE)
{
TYPE_TUPLE fields;
}
So you can do:
Structize!(int,char) foo()
{
Structize!(int,char) ret;
ret.fields[0] = 1234;
ret.fields[1] = 'a';
return ret;
}
More information about the Digitalmars-d
mailing list