Is there any overhead iterating over a pointer using a slice?

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 31 11:55:18 PDT 2016


In relation to this thread:

http://forum.dlang.org/thread/ddckhvcxlyuvuiyazpqy@forum.dlang.org

Where I asked about slicing a pointer, I have another question:

If I have a pointer and iterate over it using a slice, like this:

	T* foo = &data;

	foreach (element; foo[0 .. length])
	{
		...
	}

Is there any overhead compared with pointer arithmetic in a for 
loop?


More information about the Digitalmars-d-learn mailing list