Allocate N elements

Namespace rswhite4 at googlemail.com
Mon Jul 15 07:43:16 PDT 2013


Another question:
I have this code:

----
void main() {
	int* ptr = cast(int*) malloc(11 * int.sizeof);
	int[] arr = ptr[0 .. 11];

	assert(arr.ptr is ptr);

	arr ~= 42;

	assert(ptr !is arr.ptr);
}
----

Is it possible to prohibit that the slice is resized, to avoid GC 
allocations?


More information about the Digitalmars-d-learn mailing list