Thread: Damage error with clearing a vector

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257

    Damage error with clearing a vector

    Hi,
    I have a function that fills a vector. It can be run multiple times during the program, but I don't want it to keep filling the vector as many times as it is run. So I put in a check:
    Code:
         if((FAD.vectDL.empty()) == 0)
    	      FAD.vectDL.clear();
    FAD is a global variable because it is accessed by a bunch of functions. .empty() returns 0 if there is somehting in the vector, but .clear() causes a run-time assertion error( Damage after Normal Block (#112)....).

    Can I not clear a global vector? How would I get rid of this error?
    I tried this without other functions that use the vector. I just ran this function twice in a row.
    Last edited by earth_angel; 08-25-2005 at 08:54 AM.
    Everything is relative...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  2. syntax help?
    By scoobygoo in forum C++ Programming
    Replies: 1
    Last Post: 08-07-2007, 10:38 AM
  3. Vector class
    By Desolation in forum C++ Programming
    Replies: 2
    Last Post: 05-12-2007, 05:44 PM
  4. Need some help/advise for Public/Private classes
    By nirali35 in forum C++ Programming
    Replies: 8
    Last Post: 09-23-2006, 12:34 PM
  5. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM