copy and erase functions in STL

This is a discussion on copy and erase functions in STL within the C++ Programming forums, part of the General Programming Boards category; How do you implement the copy and erase functions for the STL for the vector.h file? And also for the ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    1

    Question copy and erase functions in STL

    How do you implement the copy and erase functions for the STL for the vector.h file? And also for the vector.cpp file? I am lost. Please help.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >How do you implement the copy and erase functions for the STL for the vector.h file?
    Um...however you want. If you're writing a vector class then it's up to you how to do it and depends heavily on the underlying structure of the vector. If you're not writing your own vector class then you need to be more specific as to what you want.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Post an example of your problem.

    Kuphryn

  4. #4
    terrancee
    Guest
    I don't think you can implement copy and erase with vectors. At least I've never done it.

    why not use pop_back and push_back?

  5. #5
    terrancee
    Guest
    sorry, found erase:
    erase(): This function erases element from the vector.

    I'll look for copy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. the stl vector class in relation to pathfinding
    By DavidP in forum Game Programming
    Replies: 4
    Last Post: 05-14-2004, 03:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21