Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ierator problem in release version

Status
Not open for further replies.

ranadhir

Programmer
Nov 4, 2003
54
IN
I have the following code:

std::vector<EMEventContainer>::iterator it=pevent.begin();

try{
while(it != pevent.end()) {
RepDataManager::Log(RepDataManager::HIDEBUG, " Processing next");

EMEventContainer curr = *it;
......
.....
.....
...
it++;
RepDataManager::Log(RepDataManager::HIDEBUG , " About to process next element");
}

This function succeeds in debug builds but results in abnormal crashes in release build .I am using VC++ .NET 7.0
How can i avoid this crash?I have read abotu checked iterators but do not know how to work around this crash.I have tried #define _SECURE_SCL 0 but to no avail.
 
Please use [ignore]
Code:
[/ignore] tags when posting code.

What else happens to the iterator in that while loop?
Which vector functions are being called in the loop?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top