immutable(T)[], allocating nothing.typedView
fn
immutable(T)[] typedView(T)(immutable(ubyte)[] raw) @safe pure nothrowReinterprets 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
T | the element type to view the bytes as |
raw | the sealed byte buffer; must be BUFFER_ALIGNMENT-aligned and its length a multiple of T.sizeof |
Returns
the buffer viewed as