converting a byte array to a struct array?

Steven Schveighoffer schveiguy at yahoo.com
Tue Dec 29 13:35:56 PST 2009


On Tue, 29 Dec 2009 10:37:43 -0500, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Tue, 29 Dec 2009 10:03:50 -0500, Trass3r <mrmocool at gmx.de> wrote:
>
>> Steven Schveighoffer schrieb:
>>> What is RGB's structure?
>>>  I would expect something like this to work:
>>>  RGB[256] PALETTE = [
>>> {0x00, 0x00, 0x00},
>>> {0xE3, 0x53, 0x00},
>>> ...
>>> ];
>>>  Assuming RGB is a struct of 3 ubyte members...
>>>
>>
>> Yeah, simply 3 ubytes.
>> But IIRC I read that struct literals will be removed in D2 so I didn't  
>> test that approach.
>
> You are right, I asked the question on that thread of whether it was  
> worth keeping struct literals for this purpose.

And the answer (created by bearophile): http://codepad.org/8HnF62s2

-Steve


More information about the Digitalmars-d-learn mailing list