On 04/11/2011 01:47 AM, Andrej Mitrovic wrote:
alias Tuple!(byte, "red", byte, "green", byte, "blue") RGBTuple;

RGBTuple GetRGB(COLORREF cref)
{
     RGBTuple rgb;
     rgb.red   = GetRValue(cref);
     rgb.green = GetGValue(cref);
     rgb.blue  = GetBValue(cref);

     return rgb;
}

[O your T]
Hello, andrej,

I'm trying to understand why people use tuples (outside multiple return values and variadic typetuples). Why do you prefere the above to:

struct RGBColor { byte red, green, blue; }

RGRColor GetRGB (COLORREF cref)
{
     RGBColor rgb;
     rgb.red   = GetRValue(cref);
     rgb.green = GetGValue(cref);
     rgb.blue  = GetBValue(cref);
     return rgb;
}

?
[/O your T]

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to