On Tuesday, 23 May 2017 at 06:42:55 UTC, Timoses wrote:
The easiest way is probably casting:
```
import std.traits;
import std.bitmanip;
class Test {
byte[4] marray;
byte mbyte;
}
void main() {
auto value = [0x12, 0x23, 0x34, 0x45, 0x56];
auto test = cast(Test*) value.ptr;
}
```
Don't cast arbitrary types to classes, you're going to stumble
upon very nasty surprises :) I guess you meant struct?
Classes in D are quite fat, and don't start with data members
right away, bookkeeping ClassInfo data comes first.