Initializes the struct.
Returnes the buffer. Moves the buffer in memory if it is misaligned.
t { import unstd.math; alias Buff = RawAutoalignedBuff!(64, 16); void[1024] sbuff = void; auto mbuff = cast(Buff*) sbuff.ptr; mbuff.initialize(); assert(isAligned!64(cast(size_t) mbuff.buff.ptr)); assert(mbuff.buff == [0, 0, 0, 0]); mbuff.buff[] = [1, 2, 3, 4]; rawCopy(sbuff.ptr, sbuff.ptr + 1, Buff.sizeof); mbuff = cast(Buff*) (sbuff.ptr + 1); assert(isAligned!64(cast(size_t) mbuff.buff.ptr)); assert(mbuff.buff == [1, 2, 3, 4]
This struct provides a static buffer of maximum size maxBytes which is aligned as requested by alignment.
The whole struct may be misaligned and moved in memory.