Intel helpfully provides a prefetch pragma; for example
#pragma prefetch a
for(i=0; i<m; i++)
a[i]=b[i]+1;
will prefetch a
a certain number of loop cycles ahead, as determined by the compiler.
But what if a
is not an array but a class with []
overridden? If operator[]
does a simple array access, can prefetch still be used in this way?
(Presumably the question applies to std::vectors
as well).