struct to byte[]

novice2 sorry at noem.ail
Wed Dec 13 02:45:13 PST 2006


== 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?



More information about the Digitalmars-d mailing list