Click here to Skip to main content
16,011,626 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Vector Assertion Failure. Pin
User 58385211-Oct-07 17:38
User 58385211-Oct-07 17:38 
GeneralRe: Vector Assertion Failure. Pin
Michael10111-Oct-07 17:55
Michael10111-Oct-07 17:55 
GeneralRe: Vector Assertion Failure. Pin
User 58385211-Oct-07 18:13
User 58385211-Oct-07 18:13 
GeneralRe: Vector Assertion Failure. Pin
Michael10111-Oct-07 18:22
Michael10111-Oct-07 18:22 
GeneralRe: Vector Assertion Failure. Pin
Michael10111-Oct-07 18:29
Michael10111-Oct-07 18:29 
GeneralRe: Vector Assertion Failure. Pin
User 58385211-Oct-07 18:29
User 58385211-Oct-07 18:29 
GeneralRe: Vector Assertion Failure. Pin
Michael10111-Oct-07 18:42
Michael10111-Oct-07 18:42 
AnswerRe: Vector Assertion Failure. Pin
jhwurmbach11-Oct-07 21:51
jhwurmbach11-Oct-07 21:51 
I have read your talk with Josh Gray, and I have only a few points to add.

a) Adding to a vector *will* invalidate all iterator in it. Not every time, but sometimes, and you cant control it. A vector is guaranteed to be in a continuous part of memory, and when it gets bigger, it is reallocated.
All Iterators are invalidated.
There are things you might try (reserve()), but it will not work most of the time.

b) The register you put before the iterator-declaration is silly. An iterator is a class and will certainly not fit into a register.

c) in the for-loop, increment the iterator using the postfix-increment-operator: ++Iter.
Also,try to dereference the iterator as few as possible. You are getting a large overhead.
Your program will be much faster in release, and stop being unusable slow in debug mode (All with VS.NET 2005).



Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words

QuestionRe: Vector Assertion Failure. Pin
David Crow12-Oct-07 2:46
David Crow12-Oct-07 2:46 
Questionconvert double to unsigned short Pin
l_d11-Oct-07 9:43
l_d11-Oct-07 9:43 
AnswerRe: convert double to unsigned short Pin
led mike11-Oct-07 10:12
led mike11-Oct-07 10:12 
JokeRe: convert double to unsigned short Pin
Mark Salsbery11-Oct-07 13:21
Mark Salsbery11-Oct-07 13:21 
AnswerRe: convert double to unsigned short Pin
Stephen Hewitt11-Oct-07 17:50
Stephen Hewitt11-Oct-07 17:50 
AnswerRe: convert double to unsigned short Pin
Nelek11-Oct-07 20:01
protectorNelek11-Oct-07 20:01 
GeneralRe: convert double to unsigned short Pin
led mike12-Oct-07 4:48
led mike12-Oct-07 4:48 
GeneralRe: convert double to unsigned short Pin
Nelek29-Oct-07 22:11
protectorNelek29-Oct-07 22:11 
QuestionFill Data in Active Window Pin
vikrant kpr11-Oct-07 9:21
vikrant kpr11-Oct-07 9:21 
QuestionImage enhancment Pin
Deepu Antony11-Oct-07 9:05
Deepu Antony11-Oct-07 9:05 
AnswerRe: Image enhancment Pin
led mike11-Oct-07 9:42
led mike11-Oct-07 9:42 
QuestionTemplate related error for non-template code? Pin
Franz Klein11-Oct-07 8:36
Franz Klein11-Oct-07 8:36 
AnswerRe: Template related error for non-template code? Pin
led mike11-Oct-07 8:58
led mike11-Oct-07 8:58 
AnswerRe: Template related error for non-template code? Pin
Nemanja Trifunovic11-Oct-07 8:59
Nemanja Trifunovic11-Oct-07 8:59 
AnswerRe: Template related error for non-template code? Pin
Stephen Hewitt11-Oct-07 17:52
Stephen Hewitt11-Oct-07 17:52 
QuestionIntegrate Borland Visibroker into VS 2005 Pin
Andy20211-Oct-07 6:38
Andy20211-Oct-07 6:38 
Questioncannot convert parameter 1 from 'char' to 'const char *' Pin
sntnknd11-Oct-07 6:26
sntnknd11-Oct-07 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.