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!