On Thursday, 21 November 2024 at 22:09:45 UTC, Jonathan M Davis
wrote:
void[] can refer to an array of anything, and it's not at all
type-safe or memory-safe to access its elements. It would be
like implicitly treating a void* like a pointer to any specific
type.
If you want to access anything in a void[], it must be cast to
something else. If you want to access the data as bytes, then
typically, casting to ubyte[] would be the appropriate thing to
do. Then you can use std.bitmanip's stuff on it to convert
groups of bytes to int or short or some other integral type.
- Jonathan M Davis
Makes sense although it seems reasonable for bitmanip.peek and
friends to work on void[] since the underlying data is assumed to
be untyped.