Thread: Vectors

  1. #16
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Note that your contactDelete function does not return a vector<contact> but a vector<contact>*.

    That method of deleting a contact is rather dangerous too as you are returning a pointer to memory which has gone out of scope. It would be better just to return void and take the vector argument as a reference and remove the contact directly from it.

    Also, in loops and such, it is a better habit to get into to use iterator!=iterator instead of iterator<=iterator as not all iterators are random access.

    Last edited by Zach L.; 11-28-2004 at 04:51 PM.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Vectors
    By naseerhaider in forum C++ Programming
    Replies: 11
    Last Post: 05-09-2008, 08:21 AM
  2. How can i made vectors measuring program in DevC++
    By flame82 in forum C Programming
    Replies: 1
    Last Post: 05-07-2008, 02:05 PM
  3. How properly get data out of vectors of templates?
    By 6tr6tr in forum C++ Programming
    Replies: 4
    Last Post: 04-15-2008, 10:35 AM
  4. How to use Vector's in C++ !?!
    By IndioDoido in forum C++ Programming
    Replies: 3
    Last Post: 10-14-2007, 11:13 AM
  5. Points, vectors, matrices
    By subnet_rx in forum Game Programming
    Replies: 17
    Last Post: 01-11-2002, 02:29 PM