This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/32068] vector push_back()/resize() causes assignment to deleted memory



------- Comment #2 from fang at csl dot cornell dot edu  2007-05-24 19:55 -------
Suggestion: determine some lower bound of the size (or exact) N prior to a
sequence of push_back()s, and call vector::reserve(N) in advance.  Then as long
as the capacity isn't exceeded, you avoid any reallocation.  


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32068


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]