Listing 10: Faster array access
Array<long, 3> A3(ArraySizes(10)(20)(30)); // See <a href="/showArticle.jhtml?documentID=cuj0012bavestre&pgno=11">listing 9</a> // Traverse Array with nested loops in a faster way for (unsigned int x=0, k=0; x<A3.size(1); x++) { SubArray<long, 2> Z2=A3[x]; for (unsigned int y=0; y<A3.size(2); y++) { SubArray<long, 1> Z1=Z2[y]; for (unsigned int z=0; z<A3.size(3); z++) Z1[z]=++k; } }