CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: buffer

  1. #1
    Join Date
    Jan 2003
    Posts
    15

    Unhappy 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!

  2. #2
    Join Date
    Dec 2002
    Posts
    1,050
    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.

  3. #3
    Join Date
    Aug 2002
    Location
    VA, USA
    Posts
    137
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured