I want a piece of code which does not involve loops but automatically generates some C++ code.
I have an const int d
, and from this I want to write d lines of code to access an array. So for instance
for(int k=0; k<d;++k){
// do something to myarryay[k];
}
but I don't want to write this in a for loop. I want the complier to execute as if the following lines of code was written:
do something to myarray[0]
do something to myarray[1]
.
.
.
do something to myarray[d]
Can anyone give me a suggestion on some code that does this?
Thanks in advance.