float[] buf = [ 1.1f, 2.2, 3.3, 4.4, 5.5 ]; auto a = getTypedArray!float( 2, cast(void*)(buf.ptr + 1) ); import std.stdio; assert( eq( a, [2.2, 3.3] ) ); a[0] = 10; assert( eq( buf, [1.1, 10, 3.3, 4.4, 5.5] ) );
See Implementation