For an array with multiple dimensions, we usually need to write a for loop for each of its dimensions. For example:
for
vector< vector< vector
Use something along these lines (its pseudo-code, but the idea stays the same). You extract the pattern to loop once, and apply a different function each time.
doOn( structure A, operator o) { for (int k=0; k