typedView

fnimmutable(T)[] typedView(T)(immutable(ubyte)[] raw) @safe pure nothrow

Reinterprets a sealed byte buffer as typed values (D2). A plain cast of immutable(ubyte)[] to immutable(T)[] is accepted in @safe code under dip1000 on all four compilers, and the runtime inserts a length-divisibility check (fact 4); this wrapper additionally asserts the BUFFER_ALIGNMENT alignment of the buffer, so views over sliced buffers that are no longer aligned fail loudly instead of silently losing vectorisability.

Parameters

Tthe element type to view the bytes as
rawthe sealed byte buffer; must be BUFFER_ALIGNMENT-aligned and its length a multiple of T.sizeof

Returns

the buffer viewed as immutable(T)[], allocating nothing.