SomeClass* stuff;
int N = 10;
stuff = new SomeClass[N];
Someclass* objectPtrDelete = null;
int i = 0;
for(Someclass* pointer = begin(); pointer != end(); pointer++)
{
if(pointer->getSomeAttr() == randomPointer.getSomeAttr()){
objectPtrDelete = pointer;
break;
}
i++;
}
// Shrinking the C-array with this for loop, shifting left
for (int j = i; j < N-1; j++)
stuff[j] = stuff[j + 1];
Can the last loop be converted into a Pointer loop, if yes, how is this properly done? Note, the names are fictional i.e. something imaginary. I have implemented something similar, but, I would like to understand how can I convert the last loop to a pointer for loop that does the same operation.
Make this:
for (int j = i; j < N-1; j++)
stuff[j] = stuff[j + 1];
Into a Pointer loop.