How can i shift an element from an ofVec3f vector?

That is, remove the element at the zeroeth index and shift the values at consecutive index down, then return the removed value.
I can see erase method in vector class

particles.erase( particles.begin() );

but i don’t see any method as a counterpart of set()

ofVec3f p = particles[0];
particles.erase(particles.begin());
return p;
1 Like

Sorry.
i mean, given

ofVec3f particles[NUM_PARTCLES];
for (int i=0; i<NUM_PARTCLES; i++) { particles[i].set(i,i,i); }

then particles[n] = (n,n,n)
Now i want to “particles.shift()” so that in this example particles[n] = (n+1,n+1,n+1);

ah, well instead of using an array use a vector:

vector<ofVec3f> particles;
particles.resize(NUM_PARTICLES);

that way my code will work