struct to byte[]

Endea notknown at none.com
Wed Dec 13 03:10:14 PST 2006


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!



More information about the Digitalmars-d mailing list