-
buffer
I have to write a buffer to store some video sequences. The way I know now is to create
a vector such as vector<imagetype*> buffer.
when I push_back the images into the vector.
How can I operate on the images in the buffer?
for example do some addition or substraction
with the images within the buffer?
Thanks if anyone can help me out!
-
Do you mean 'how do I remove images from the vector and insert images into the vector' ?
If yes and you are using the stl vector then the members insert()and erase() should be what you want.
Otherwise, I don't know what you mean by adding and subtracting images.
-
yelllowstone,
If you have your image object pointers stored in a vector
and you want to access the objects in the vector you can
access them in several basic ways (provided you know
the vector location of the image pointer):
Using the vector [] operator:
img_vector[2]->DoImageOp();
Using the vector at() method:
img_vector.at(2)->DoImageOp();
Using iterators:
std::vector<img*>::iterator iter = img_vect.begin() + 1;
(*iter)->DoImageOp();
If the location of the image(s) you want are unknown you
can "loop" or "iterate" through the vector using one of the
above access methods.
regards, willchop