struct to byte[]
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Wed Dec 13 12:22:32 PST 2006
Endea wrote:
> novice2 kirjoitti:
>> == Quote from Alexander Panek (a.panek at brainsware.org)'s article
>>> ubyte [] toByteArray (T) (T t) {
>>> return (cast(ubyte *)&t)[0..T.sizeof].dup
>>> }
>>
>>> auto b = toByteArray!(Foo)(f); // Yay!
>>
>> why we need two parameters?
>> compiler don't know type of f?
>
>
> This works:
>
> auto b = toByteArray(f); // Yay!
Huzzah for IFTI!
-- Chris Nicholson-Sauls
More information about the Digitalmars-d
mailing list